[KLUG Programming] Socket read problem

Adam Tauno Williams awilliam at whitemice.org
Thu Nov 4 06:57:32 EST 2004


> Each thread establishes its own socket when its spawned and the threads
> never terminate, unless the appl is killed or dies.
> Why would it matter if there was no data to read? Wouldn't the socket read
> just block until data arrived?

Unless some extraneous error condition occurs, or some type of timeout.

Specifically invalid data (munched packet) recieved on a socket can
invoke this condition.

Have you considered just using something like libevent to manage the
socket communications? http://www.monkey.org/~provos/libevent/  Writing
a socket listener is easy, writing a really robust socket listner is
hard.



More information about the Programming mailing list