Posted by David on February 07, 2006 at 20:59:54:
In Reply to: Re: Interrupting a socket waiting on nlAcceptConnection() or nlRead()? posted by Phil Frisbie, Jr. on February 07, 2006 at 14:15:57:
: This statement confuses me. Why is nlShutdown() not viable? I cannot think of any reason to unblock a single thread unless you are going to shut down the server, and so you would, of course, call nlShutdown().
Because nlShutdown() shuts down your whole network interface. I want to be able to start and stop a server thread independantly of any other connections I might have running. Especially if I have another connection listening on another port.
: I will, however, look into why calling nlClose() results in a deadlock, since that SHOULD work anyway.
I tried to call nlClose() on a socket that's blocking on nlAcceptConnection() specifically. Havne't tried it on a thread blocking on nlRead() yet.
: I still would like to know WHY you think you need to unblock a single thread when you are NOT shutting down??
Haven't tried it on nlRead() yet, so maybe this isn't an issue- but I'd like to be able to close one network connection and leave another one up and running.
Also, nlThreadSleep() is listed internally- possibly make that public?
One last thing. I tried using nlEnable(NL_BLOCKING_IO) before making a connection, then nlDisable(NL_BLOCKING_IO) after connecting because it's handy to have it just block for connecting. The next time I use nlRead() however, it still blocks. Is this ... not a way I can use these features? [didn't check the error code on nlDisable() yet, but if/why would it fail?]