Boost logo

Boost :

From: jk_at_[hidden]
Date: 2002-03-01 01:53:11


24 Feb 2002 06:44:28 +0300 davlet_panech wrote:
>// An acceptor bound to a local address
>acceptor_socket< tcp_ip4 > server( "localhost:80" );

This form of address representation requires redundant parsing; why not
to represent an address as, say, net_address("localhost", 80), like:

class net_address {
     const char *hostname_; // or std::string or something
     unsigned short port_;

     // or, may be
     // struct sockaddr_in sockaddr_;
public:
     net_address(const char *, unsigned short);
     // etc.
};

acceptor_socket< tcp_ip4 > server( net_address("localhost", 80) );

The parsing step must be leaved to external human-machine interfacing.

-- 
jk

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk