tags:

views:

167

answers:

1

Hi

I am having an application which listens on a particular RPC Port number say 10001 for connection with another device(hardware) using socket programming.

Meanwhile the hardware device will be trying to establish connection to my IP and same port number 10001.

So that way my application and the hardware are connected. Now assume i disconnect the network cable from my machine, my application would still be listening on port number 10001, however it wont receive any connection.

Now if i reconnect the network again then is it possible for me to reuse the same socket which i was using earlier for communicaiton with the hardware.

Do i sound confusing

Thanks

A: 

Once an established socket has been disconnected, you cannot reuse it. You must shut down the old socket and allocate a new one. However, pulling out the network cable on the listening end should not have any effect on the existing listening socket being able to accept new connections once the cable has been put back in, though. If it is not able to do that, then your OS's socket stack is likely faulty.

Remy Lebeau - TeamB
Even i feel the same way. Probably some thing else is wrong with my code but i can see that my application is listening for a connection on that particular port number with and without the network cable
ckv