~registry/scalestack/trunk

« back to all changes in this revision

Viewing changes to scalestack/network/ip/tcp/connection.cc

  • Committer: Eric Day
  • Date: 2010-12-04 17:17:34 UTC
  • mfrom: (56.1.9)
  • Revision ID: git-v1:9c392b034d652023a4b28ae2976aca128bb856c2
Merged Eric's branch with style updates, config file support, and other cleanup.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
#include <cerrno>
19
19
#include <cstring>
20
 
#include <sys/types.h> /* Must be before socket headers for Free_bSD. */
 
20
#include <sys/types.h> /* Must be before socket headers for Free BSD. */
 
21
#include <netdb.h>
21
22
#include <netinet/in.h>
22
23
#include <netinet/tcp.h>
23
24
#include <sys/socket.h>
42
43
 * Public methods.
43
44
 */
44
45
 
45
 
connection::connection(connection_service& creator):
46
 
  network::stream_provider(creator)
 
46
connection::connection(connection_service& connection_service):
 
47
  network::stream_provider(connection_service)
47
48
{
48
49
}
49
50
 
71
72
  }
72
73
}
73
74
 
74
 
void connection::connect(const std::string& host, const std::string& port)
 
75
void connection::connect(const std::string& address)
75
76
{
 
77
  std::string host;
 
78
  std::string port;
 
79
 
 
80
  string::size_type port_offset = address.find_first_of(":");
 
81
  if (port_offset == string::npos)
 
82
    host = address;
 
83
  else
 
84
  {
 
85
    host = address.substr(0, port_offset);
 
86
    port = address.substr(port_offset + 1);
 
87
  }
 
88
 
76
89
  struct addrinfo addrinfo_options;
77
90
 
78
91
  if (_address_list != NULL)