Network server design question

Jonathan M Davis jmdavisProg at gmx.com
Mon Aug 5 15:28:05 PDT 2013


On Monday, August 05, 2013 16:07:40 David Nadlinger wrote:
> I don't think that would be possible – std.socket by design is a
> thin wrapper around BSD sockets (whether that's a good idea or
> not is another question), and how to handle partial writes
> depends entirely on the environment the socket is used in (think
> event-based architecture using fibers vs. other designs).
> 
> In general, I wonder what the best way for going forward with
> std.socket is. Sure, we could try to slowly morph it into a
> "modern" networking implementation, but the current state also
> has its merits, as it allows people to use the familiar BSD
> sockets API without having to worry about all the trivial
> differences between the platforms (e.g. in symbol names).

I'm all for std.socket being completely rewritten. I think that how it's tied 
to BSD sockets is a major liability. Where I work, we have a platform-
independent socket class (in C++) which is generic enough that we have a 
derived class which uses OpenSSL so that you can swap between normal sockets 
and SSL sockets seemlessly. You can't do anything of the sort with std.socket.

Unfortunately, I have neither the time nor the expertise at this point to 
rewrite std.socket, but if no one else does it, I'm sure that I'll write 
something eventually (whether it makes it into Phobos or not), because I 
really, really don't like how std.socket is put together. Having used a socket 
class which enables you to seemlessly pass around SSL sockets in the place of 
normal sockets, and having seen how fantastic and wonderful that is, I'm
likely to have a very low opinion of a socket class whose design does not
allow that.

- Jonathan M Davis


More information about the Digitalmars-d mailing list