Add file_desc::connect()

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
This commit is contained in:
Takuya ASADA
2014-11-28 04:17:10 +09:00
parent a5802e36a2
commit c01e9dc8d6

View File

@@ -196,6 +196,13 @@ public:
auto r = ::bind(_fd, &sa, sl);
throw_system_error_on(r == -1);
}
void connect(sockaddr& sa, socklen_t sl) {
auto r = ::connect(_fd, &sa, sl);
if (r == -1 && errno == EINPROGRESS) {
return;
}
throw_system_error_on(r == -1);
}
socket_address get_address() {
socket_address addr;
auto len = (socklen_t) sizeof(addr.u.sas);