Socket is open... but then never established

I’m working with DC9.01. My application uses a couple of tcp_sockets, and they are used eventually in different costates.

Everything seems to work fine… but then, from time to time, it happens that a socket is open, and then never achieves the “established” status, so there becomes a neverending loop:


while(!sock_established(&(worklist_socket[User])) && sock_bytesready(&(worklist_socket[User]))==-1)
// only_local is 0
// the loop remains looping and looping through this branch…

Can you guess what can happen, so that socket was open but never reaches the condition of “established”?

OK, self-solved :slight_smile:

It’s funny that there exists a constant (TCP_MAX_SOCKETS or something like this) in tcp.lib or net.lib, where the maximum number of simultaneous open sockets is defined.

Then, if you reach this number, the next attempt of tcp_open returns a 0, which is documented as “cannot resolve the target address”…

The solution, of course, is editing the .lib and increasing the constant.