Re: How to not accept a new socket connection?
If you don't call Accept then the connecting socket will timeout.
Or you can simply shotdown the listening socket.
I would personally Accept the connection but then turn around and send a
message that the connection limit has been reached and then disconnect it.
AliR.
"Danny Pressley" <DannyPressley@newsgroup.nospam> wrote in message
news:DD2D3DCA-F863-412C-A7BC-4D0F2C3D2A3A@microsoft.com...
Hello,
I am using CAsyncSocket for my client/server application, everything works
fine and I can open as many socket connections as I want, but I would like
to
limit the number of connections (say 10 sockets at any one time). During
the
OnAccept() call of my listen socket, is there something I can do to refuse
the connection, or maybe some other way outside of OnAccept(). Once my
open
socket count goes back below my set limit, I would like to start accepting
connections again until the limit is maxed out again.
FYI: I've tried to not call Accept() from within OnAccept(), but the
client
side still gets a connection made. I've also tried to call the Win32 API
accept(NULL,NULL,NULL) from within OnAccept() and the client still gets a
connection made.
Thanks for any help and best regards,
Danny