std.socket is horrible.

cemiller chris at dprogramming.com
Sun Aug 22 16:59:54 PDT 2010


Would the problems be resolved with the following changes?


Add a Socket class constructor:
this(socket_t sock, AddressFamily af)
{
	assert(sock != socket_t.init);
	this.sock = sock;
	this._family = af;
}


Socket.newFamilyObject():
This is currently private but can be made protected to allow overriding to  
return new address types.


Address.name() and Address.nameLen():
Is there a function you need to call with these? I suppose they can be  
made public just in case they're needed elsewhere.


As for things like _SOCKET_ERROR and _lasterr(), they're just simple  
shortcuts to the low-level sockets. If you're working with the low-level  
sockets, then you have access to what _SOCKET_ERROR and _lasterr() refer  
to; otherwise, you don't need them.


More information about the Digitalmars-d mailing list