in reply to Re^2: Problem extracting socket from fileno
in thread Problem extracting socket from fileno
Generally, what you're trying to do here is only borderline supported (if at all!). There's a reason why sockets aren't created with open — the underlying file descriptor is only part of what the OS needs to operate a socket. And I'd wager it's one of those subtle differences (to regular file handles) that are responsible for the problems you're observing. (This is also known as "In Unix everything is a file ...unless it isn't" ;) such as sockets.)
In this specific case, it looks like the output the server has written ("nice to meet you") is immediately fed back to itself, so its own output gets in the way of new input... (I can't replicate this behaviour here, btw, but that's probably just due to minor timing differences on my system, or whatever).
In short, it's probably best to give up that route, and try to find some other way of implementing it. What's the bigger picture of things you're trying to accomplish in the end? Maybe people can suggest alternative approaches...
|
|---|