499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
|
if ((sock = socket(res->ai_family, SOCK_STREAM, 0)) == INVALID_SOCKET)
@throw [OFBindFailedException exceptionWithClass: [self class]
socket: self
host: host
port: port];
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)))
@throw [OFSetOptionFailedException
exceptionWithClass: [self class]
stream: self];
if (bind(sock, res->ai_addr, res->ai_addrlen) == -1) {
freeaddrinfo(res);
close(sock);
|
|
>
|
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
|
if ((sock = socket(res->ai_family, SOCK_STREAM, 0)) == INVALID_SOCKET)
@throw [OFBindFailedException exceptionWithClass: [self class]
socket: self
host: host
port: port];
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char*)&one,
sizeof(one)))
@throw [OFSetOptionFailedException
exceptionWithClass: [self class]
stream: self];
if (bind(sock, res->ai_addr, res->ai_addrlen) == -1) {
freeaddrinfo(res);
close(sock);
|
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
|
# endif
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
@throw [OFBindFailedException exceptionWithClass: [self class]
socket: self
host: host
port: port];
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)))
@throw [OFSetOptionFailedException
exceptionWithClass: [self class]
stream: self];
if (bind(sock, (struct sockaddr*)&addr.in, sizeof(addr.in)) == -1) {
close(sock);
sock = INVALID_SOCKET;
|
|
>
|
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
|
# endif
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
@throw [OFBindFailedException exceptionWithClass: [self class]
socket: self
host: host
port: port];
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char*)&one,
sizeof(one)))
@throw [OFSetOptionFailedException
exceptionWithClass: [self class]
stream: self];
if (bind(sock, (struct sockaddr*)&addr.in, sizeof(addr.in)) == -1) {
close(sock);
sock = INVALID_SOCKET;
|