Hi,
I am implementing async socket. I have a client and Server(listener). When a listener disconnects I get notified in OnReceived call back function. Is there anyway I can find out when the listener starts listening again
FOe xample, I have an application that has start listening and stop listening buttons. When I click stop listening the client gets notified in its OnReceived function. NOw if I click Start listening then client does'nt get notified that someone at this port is listening again. Is it possible to know that a listener is now listening
THanks,

how to know at client that a listener has connected
dpage2006
A single socket port cannot be connected to more than one client application at a time. This is why there is a listener port, which defers (accepts) to a optionally "randomly" generated unique port. A request comes in on a known port (say 49000), the listener then, essentially, accepts a connection to the client to on a different, free, port, say 50000. The client automatically communicates with that new port number. Usually the client code doesn't care what port is used, the number is ephemeral and is hidden in the socket communications implementation.
If you try and connect to port that is connected, you will get an in-use error. A listener port is (normally) never in-use; connection requests to that port will get queued.
Also, you can't send data (directed) on a socket that is not connected.
simian
One more related question about sockets. Lets say if there is some communication going on at a given socket and while its taking place another application[client] tries to send data on the same socket, what will happen
Will it maintain a queue so that as soon as socket becomes available again, it will send the pending data or will it just throw an exception saying the socket is currently busy
Thanks,
Adi2
Valentin
When you start listening the sockets library begins looking for connection requests. If the client is not making a connection request (that succeeds) it will not know if a listener is running.
Your client will have to poll (i.e. periodically attempt to make a connection to that server:port in order to tell if a listener is listening.
Andrej Zeleznik
You could broadcast a message on another socket that you're going into a listening state (if both client and server are on the same subnet); but, there's no guarantee that the client will get the broadcast, i.e. the server will not inherently know if the client received the broadcast.
There's also no guarantee that just because the last poll found the server doesn't mean the server is still listening.
samForASP