Hi,
How can a single socket be used to accept() as well as to connect().? Is it possible and what is the best way to implement it? Any sample code would be helpful.
Here is what I want to do.
Open a socket on a port and accept() on it for a certain amount of time. If a connection is received in that time from the remote peer then send/recv with new socket descriptor. Otherwise, attempt a connection to the remote peer using the same socket and once established, start send/recv.
I am developing on linux.
Thanks,