Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Network Stream blocked!

Status
Not open for further replies.

alphador

Programmer
Dec 3, 2007
4
IT
Hello!

I'm doing a client server application via TCP/IP and I need to transfer files: while the client transfers chunks of data, it waits for an acknowledge from the server, by doing this:

Code:
netStream.Read(data, 0, 1);

It means that it waits 1 byte from the server, then it goes on.
However if for some reason the server does not send the acknowledge to the client, this instruction blocks the application...

Is there another way to get an acknowledge without the risk of freezing the thread/application ?

Thanks
 
Thanks, I will try that.
Still wandering though what is the
Code:
allDone.WaitOne();
instruction in that link. That is, I don't get where the "allDone" comes from...
 
hmmm...I didn't look that closely at the code example they gave. The allDone object is a AutoResetEvent object. It lives within the System.Threading namespace.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top