Re: TCP Sockets errors
- From: "Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com>
- Date: Tue, 18 Apr 2006 14:32:59 -0700
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).
.
- Follow-Ups:
- Re: TCP Sockets errors
- From: Safiiru no Baka
- Re: TCP Sockets errors
- References:
- Re: TCP Sockets errors
- From: Safiiru no Baka
- Re: TCP Sockets errors
- From: Safiiru no Baka
- Re: TCP Sockets errors
- From: Paul G. Tobey [eMVP]
- Re: TCP Sockets errors
- From: Safiiru no Baka
- Re: TCP Sockets errors
- From: Paul G. Tobey [eMVP]
- Re: TCP Sockets errors
- From: Safiiru no Baka
- Re: TCP Sockets errors
- From: Paul G. Tobey [eMVP]
- Re: TCP Sockets errors
- From: Safiiru no Baka
- Re: TCP Sockets errors
- From: Paul G. Tobey [eMVP]
- Re: TCP Sockets errors
- From: Safiiru no Baka
- Re: TCP Sockets errors
- From: Paul G. Tobey [eMVP]
- Re: TCP Sockets errors
- From: Safiiru no Baka
- Re: TCP Sockets errors
- From: Paul G. Tobey [eMVP]
- Re: TCP Sockets errors
- From: Safiiru no Baka
- Re: TCP Sockets errors
- From: Paul G. Tobey [eMVP]
- Re: TCP Sockets errors
- From: Safiiru no Baka
- Re: TCP Sockets errors
- From: Paul G. Tobey [eMVP]
- Re: TCP Sockets errors
- From: Safiiru no Baka
- Re: TCP Sockets errors
- Prev by Date: GetDeviceFileSize with Progressbar
- Next by Date: Re: P/Invoke and NotSupportedExceptions
- Previous by thread: Re: TCP Sockets errors
- Next by thread: Re: TCP Sockets errors
- Index(es):
Relevant Pages
|