Auto close on listener socket?


#1

Actually I’m struggling on a TCP listener function. (=server)

I’m opening a listener socket, waiting for a connection.
Connecting, receiving, transmitting, everything works well. But on connection close the whole listening port is closed, too.
If another client is doing a new connect, there will be no listening socket :confused:
My “workaround” is to reinitialize a listener socket after each successful client [connecting - data exchange - closing] sequence.

Is there a way to leave the listener untouched, listening all the time?
Cause reopening the listening port takes some time, and therefore requiring a schedule/retry mechanism on the “client” side.

tia,
Heinz


#2

For edLib, the listening mode will not be re-opened by itself automatically. So you need to write your own routine to restart listening mode in case socket is closed.

Or you can switch to the new wipLib. The server (listening) mode uses a new mechanism; socket will be establihed on a newly “spawned” channel, so the original listening port can still accept other connection request. Closing the spawned channel also does not affect lthe istening port.


#3

Thanks for the information, Wallace. That’s what I’m doing now. When I receive a “ED_OK_TCP_CLOSED” I’m reopening it. It works, but it’s not that smart.

Sounds good to me, I think I give it a try. But maybe in a few weeks, for the actual project I’m stucked to eDLib I’m afraid.
BTW, do you know, if wipLib exists for all platforms? Or does this affect only the OAT4.xx? I’m stucked to 3.10 environment for a Q2501 at the moment.

Heinz