www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - std.socket and std.socketstream

Users who consider using these two modules in conjunction should beware of
clashes.

I used std.socketstream in a micro-server context to read the individual lines
of an http request.

After that I reverted to socket level to keep the connection open for some time
so that the client could re-use it.

At that point, Socket.select() became completely broken, always returning
immediately, regardless of the timeout argument. Creating the SocketStream
within a block cured this to some extent, but then there appeared to be some
persistence of the object after the closing brace of the block, possibly before
the garbage collector killed it, and after an unknown timeout period,
everything broke again.

I would therefore suggest that use of SocketStream be restricted to
circumstances where the socket connection is local and reliable, and not
intermingled with the direct use of Socket.select().

I can't be more specific at the moment, but even this little knowledge might
save somebody a lot of wasted time.

Steve
Nov 16 2010