Re: TCP Sockets errors

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



If you mean, "How do I continue processing incoming data on the first
connected socket?", you'd put the read code, GetString, and Invoke in a loop
and have that loop run until either you've received all the data you want
(at which time you'd close the socket), or until the guy at the other end of
the pipe closes the socket, at which time you'd close your end and drop back
to the outer loop waiting for another connection.

Paul T.

"Safiiru no Baka" <wtfxxx@xxxxxxxxx> wrote in message
news:1145389328.029546.92770@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi, wow thats a problem ... How would I "drop back" to the thread from
the Invoke call?

I have rewritten the code for App2:
=========================================================
while (runListener)
{
//if (tcpListener.Pending())
//{
TcpClient tcpClient =
tcpListener.AcceptTcpClient();
Stream s = tcpClient.GetStream();
Byte[] buffer = new Byte[10000];
int bytes = s.Read(buffer, 0, buffer.Length);
string data = Encoding.ASCII.GetString(buffer, 0,
bytes);

results = "-->" + data;
this.Invoke(new EventHandler(showResults));

//}
Thread.Sleep(0);
}
=========================================================

Same exact code but note that I commented out looking for
"tcpListener.Pending()" but I am still getting the same behaviour (one
iteration only).



.



Relevant Pages

  • Re: Problem with OnReceive method
    ... > I' m developing a multithread application with a socket network ... > continuosly Receive in the thread socket loop. ... > this one start the server thread. ... when a connection arrived it start a new childthread and ...
    (microsoft.public.vc.mfc)
  • Re: GNAT.Sockets. Blocking?
    ... some servers to prevent robot or programs ... request some browsers information or they close the connection. ... end loop ... I'm kind of new to socket programming and I need some help here. ...
    (comp.lang.ada)
  • Re: tcp connection in gui: event based
    ... Write a small proc that does the accept and sets the connection to ... Use to register procs that get fired when the socket is ... If you have a full line, send it to the GUI, maybe dispatching via ... after to not block the event loop if its a bit bigger ...
    (comp.lang.tcl)
  • Re: Clarification please
    ... Sorry writing the last post i did figure out the answer, in my loop as i ... read the string i escape the loop on reading a 0, ... > connection, send data, close the socket and repeat. ...
    (microsoft.public.win32.programmer.networks)
  • [PATCH 0/5] [RFC] AF_RXRPC socket family implementation [try #3]
    ... These patches together supply secure client-side RxRPC connectivity as a Linux ... kernel socket family. ... presentation side is left to the client. ... Each connection goes to a particular "service". ...
    (Linux-Kernel)