Rejecting connection attempts on socket
- From: Kenneth Brody <kenbrody@xxxxxxxxxxx>
- Date: Tue, 22 May 2012 12:02:07 -0400
I've searched and searched, and I have a feeling the answer is "you can't", but I figured I'd ask here just in case I missed something.
I have a socket, I've bound it to a port, and entered a listening state. I have accepted several connections, and do not want to talk to any more clients until I am done with one of them.
Now, I want further connection attempts to receive ECONNREFUSED.
I do not want to accept the connection and immediately close it. I do not want to simply not call accept, and have the client hang around, waiting for the eventual ETIMEDOUT. I just want a simple "I'm too busy to talk to you, go away, ECONNREFUSED" error. (Actually, I'd settle for any error on the client side, as long as it was immediate.)
And, once I've finished with one of the clients I'm talking to, I want to be able to go back to accepting connections.
Windows' WSAAccept() API call has a callback function which allows me to say "reject this connection", but I don't see anything in POSIX to allow this.
Have I missed something, or is this really "sorry, you can't do that"?
- Prev by Date: Re: Search for API function to activate a task and return it's PID to the caller
- Next by Date: Re: Rejecting connection attempts on socket
- Previous by thread: read system call hangs
- Next by thread: Re: Rejecting connection attempts on socket