Forum Discussion
Altera_Forum
Honored Contributor
12 years agoCan the connect() for a TCP client be configured as "blocking" ?
I'm developing a TCP client using NicheStack. Can the connect() for a TCP client be configured as "blocking" ? Currently, if no server is listening for the connection the connect() returns -...
Altera_Forum
Honored Contributor
12 years agoYes, the socket is blocking by default.
In order to set non-blocking mode you must call: setsockopt(your_socket, SOL_SOCKET, SO_NONBLOCK, &max_socket, sizeof(int)); IIRC you could also set the default behaviour in Nichestack configuration file ipport.h