I am designing an application which communication using Ports (8888). I pass a message on port to a remote system and waiting the Remote system response which some time takes more than 5 second to response.
it is a long time to wait. so I use a timer which wait for 3 seconds if the connection established then it got OFF else application need to close the socket using .close() function.
I noticed it did not close the port and still wait for resolving the Host.
Is there any way to give a shutup call to socket closing so that next remote system could be entertained.
Im not exactly sure what your question is, but I will attempt to give you an answer.
I will make a few assumptions and restate a few things for clarity.
You are connecting to a server on port 8888.
After you have connected, responses from the server could take upto 5 seconds.
If it takes to long for a response you want the connection to close.
I find using the TcpClient Class easier when it comes to networking.
By the way I find not many people actually read or reply in the network forum. Try the Visual Basic .Net forum. Its probably not the right place to post networking questions but there are a LOT more people reading it. Just dont post the same question in multiple forums.
EDIT: I just re-read your post. Are you saying it could take 5 seconds just to connect to the server?
If that is the case look at the lingerstate property of the tcpclient. That might help.
Last edited by 2ndmessiah; Jul 11th, 2012 at 11:38 AM.