POSIX TCP Client and unit test between POSIX TCP Client <=> Server.

Commented out, thanks for noticing.

Thanks,
Dima

http://dimakorolev.com/ | http://www.linkedin.com/in/dimakorolev |
dmitry.korolev@gmail.com | +1 (312) 593 2783


On Sun, Dec 7, 2014 at 10:59 PM, Alex Zolotarev <notifications@github.com>
wrote:

> In net/posix_tcp_server.h:
>
> >    void operator=(const Socket&) = delete;
> >    void operator=(Socket&&) = delete;
> >  };
> >
> > +// POSIX allows numeric ports, as well as strings like "http".
> > +template <typename T>
> > +inline Connection ClientSocket(const std::string& host, T port_or_serv) {
> > +  class ClientSocket final : public SocketHandle {
> > +   public:
> > +    inline explicit ClientSocket(const std::string& host, const std::string& serv)
> > +        : SocketHandle(SocketHandle::NewHandle()) {
> > +      struct addrinfo hints {};
> > +      struct addrinfo* servinfo;
> > +      hints.ai_family = AF_INET;
> > +      hints.ai_socktype = SOCK_STREAM;
> > +      hints.ai_protocol = IPPROTO_TCP;
> > +      const int retval = ::getaddrinfo(host.c_str(), serv.c_str(), &hints, &servinfo);
> > +      if (retval) {
> > +        fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(retval));
>
> Why not cerr?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/KnowSheet/Bricks/pull/5/files#r21440799>.
>