H
Holger Fleckenstein
Hi
I have written a C++ server and an IDL client, that are supposed to
communicate over sockets. Circumstances require, that only one client
can connect at a time, and possible others are refused.
So the first thing I did, was to set a short connection timeout on the
client (IDL) side:
socket, lun, port, connect_timeout=1
This was only partially successful, because the server can queue a
number of clients, that are basically in a waiting loop. The number of
clients, that are queued by the server (C++) is specified in the
listen() function of <winsock2.h>:
listen(SOCKET s,int backlog)
So if I set backlog=1, I can connect with one client, another one is
queued and a third one is refused. The 3rd IDL client actually returns
after the specified 1sec realizing he couldn't connect. So far so
good.
The strange behavior starts now: even if I set backlog=0 on the C++
side, the server seems to queue one (not more) client, while servicing
another.
Now my question: how do I get the server to not keep any client in the
waiting queue?
If there is no solution on the C++ side, is there any way on the IDL
side, to make the client realize he is only in a queue and abort?
Thanks,
Holger
I have written a C++ server and an IDL client, that are supposed to
communicate over sockets. Circumstances require, that only one client
can connect at a time, and possible others are refused.
So the first thing I did, was to set a short connection timeout on the
client (IDL) side:
socket, lun, port, connect_timeout=1
This was only partially successful, because the server can queue a
number of clients, that are basically in a waiting loop. The number of
clients, that are queued by the server (C++) is specified in the
listen() function of <winsock2.h>:
listen(SOCKET s,int backlog)
So if I set backlog=1, I can connect with one client, another one is
queued and a third one is refused. The 3rd IDL client actually returns
after the specified 1sec realizing he couldn't connect. So far so
good.
The strange behavior starts now: even if I set backlog=0 on the C++
side, the server seems to queue one (not more) client, while servicing
another.
Now my question: how do I get the server to not keep any client in the
waiting queue?
If there is no solution on the C++ side, is there any way on the IDL
side, to make the client realize he is only in a queue and abort?
Thanks,
Holger