Hi,
What server are you talking about? A web server or just a custom made
chat-kind-of server? Anyway the way I used to do once was based on the fact
that the read method of NetworkStream class (returned from tcpclient class i
think) gives us a blocking call. This means I can create a separate thread
( lets call it a mychat thread) and go in an infinite loop calling a Read
method. Whenever there is a response, I get the length of that response too
(as a read method return value) so I allocate the required buffer, read it
and the pass it to the GUI for an update, than go back into the blocking
call. In case the other end gets disconnected we are notified of it too
although I dont remember if its judged by a negative return value or an
exception.
Its something that I remember when I once made an app using .net sockets. I
hope it helps.
regards,
..ab
"Nobody" <no****@nowhere.orgwrote in message
news:uX**************@TK2MSFTNGP04.phx.gbl...
Hi all,
I try to write a small client that can handle some TCP communication
message.
I was wondering how I could use the TcpClient class to manage it.
At the first time, I don't want to play with the async methods. My main
issue is related about receiving informations back from the server. How
can I be sure that the server has finished sending the response? Should I
set a read timeout and catch the exception when it times out? How large
should be my buffer? Any sample?
Thanks a lot in advance