Good question, and it's even better that you plan to throw away the code
:o).
Walter?
Masahiro, I'll get back to you with a review soon. Thanks for the great
work!
Andrei
On 07/08/2010 12:39 PM, Masahiro Nakagawa wrote:
Thanks.
I have something on my mind in committing this change.
std.socket doesn't seem to be Boost license. Why? Can be changed?
Masahiro
On Wed, 07 Jul 2010 12:24:04 +0900, Sean Kelly <[email protected]>
wrote:
Sounds great.
Sent from my iPhone
On Jul 5, 2010, at 12:08 PM, "Masahiro Nakagawa"
<[email protected]> wrote:
std.socket lacks some features and I don't like current design. So, I
rewrote this module.
Summary:
- Change API of Protocol, Service, and InternetHost.
-----
/* old */
Protocol proto = new Protocol; // construct before check
enforce(proto.getProtocolByType(ProtocolType.TCP)); // check
// do stuff
/* new */
Protocol proto = enforce(Protocol.getByType(ProtocolType.TCP)); //
construct after check
// do stuff
-----
I leaves these classes for aliases(getaddrinfo can't get aliases).
- Add AddressInfo class(wraps C's addrinfo struct)
AddressInfo resolves some address familes. I added AF_UNIX support.
This class is useful for Socket and Endpoint initialization.
In the future, above classes should be moved to std.net(or std.net.dns).
- Endpoint
I think Address should not have port. Address is a address, not a
endpoint.
So I added Endpoint structs(derived their name from Asio) and
Endpoints use corresponding Addresses.
-- IPEndpoint
This struct supports IPv4 and IPv6 using IPAddress.
-- LocalEndpoint
This struct supports local path using LocalAddress.
- Socket
Socket is a template bacause Socket should support any address familes.
Old Socket uses class-inheritance, but newFamilyObject is
bad(newFamilyObject can't use user-defined class).
Some methods of old Socket used return-value checking :(
- SocketSet
add and remove methods are typesafe-variadic function.
- Add const and attribute
Sources:
- socket.d
http://bitbucket.org/repeatedly/scrap/src/tip/socket.d
unittest is a simple example.
- socketstream.d
http://bitbucket.org/repeatedly/scrap/src/tip/socketstream.d
std.stream will be replaced or eliminated. This module need?
- LocalEndpoint sample
http://bitbucket.org/repeatedly/scrap/src/tip/sample/echo_server.d
http://bitbucket.org/repeatedly/scrap/src/tip/sample/echo_client.d
Contribution from satoru_h
I would like to commit this change. What do you think?
Masahiro
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos