673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
|
- (bool)of_connectSocketToAddress: (const of_socket_address_t *)address
errNo: (int *)errNo
{
if (_socket == INVALID_SOCKET)
@throw [OFNotOpenException exceptionWithObject: self];
if (connect(_socket, &address->sockaddr.sockaddr,
address->length) != 0) {
*errNo = of_socket_errno();
return false;
}
return true;
}
|
|
|
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
|
- (bool)of_connectSocketToAddress: (const of_socket_address_t *)address
errNo: (int *)errNo
{
if (_socket == INVALID_SOCKET)
@throw [OFNotOpenException exceptionWithObject: self];
if (connect(_socket, (struct sockaddr *)&address->sockaddr.sockaddr,
address->length) != 0) {
*errNo = of_socket_errno();
return false;
}
return true;
}
|
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
|
#if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC)
if ((flags = fcntl(_socket, F_GETFD, 0)) != -1)
fcntl(_socket, F_SETFD, flags | FD_CLOEXEC);
#endif
setsockopt(_socket, SOL_SOCKET, SO_REUSEADDR,
(const char *)&one, (socklen_t)sizeof(one));
#if defined(OF_WII) || defined(OF_NINTENDO_3DS)
if (port != 0) {
#endif
if (bind(_socket, &address.sockaddr.sockaddr,
address.length) != 0) {
int errNo = of_socket_errno();
|
|
|
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
|
#if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC)
if ((flags = fcntl(_socket, F_GETFD, 0)) != -1)
fcntl(_socket, F_SETFD, flags | FD_CLOEXEC);
#endif
setsockopt(_socket, SOL_SOCKET, SO_REUSEADDR,
(char *)&one, (socklen_t)sizeof(one));
#if defined(OF_WII) || defined(OF_NINTENDO_3DS)
if (port != 0) {
#endif
if (bind(_socket, &address.sockaddr.sockaddr,
address.length) != 0) {
int errNo = of_socket_errno();
|