Click here to Skip to main content
15,891,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a socket : socket mySock.
I want to set timeout for its function receive. I do: mySock.Receivetimeout = 100.

But when I use mySock.Receive(buff), it closed mySock connection. I want it only escape receive function, not closed connection. How can I do this?

Thanks for any help!
Posted
Updated 11-Jun-10 5:48am
v3

as you said when you set the receive time out and if the socket failed to receive data with in the given period of time "SocketException" will be thrown and it will cause the socket to close , so you better catch this exception and handle it properly
 
Share this answer
 
I use try{myclient.receive(...)} cath{}, but i don't know how to sovle this exception. mysoket is still closed. can you give me some code to solve it? thanks!
 
Share this answer
 
Comments
#realJSOP 11-Jun-10 11:39am    
Have you ever heard of google?
nguyenvanven 11-Jun-10 21:14pm    
I used it, but no result can soleve my problem

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900