61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
struct addrinfo hints, *res, *res0;
char portstr[6];
if (!port) {
/* FIXME: Throw exception */
return nil;
}
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
snprintf(portstr, 6, "%d", port);
|
>
>
>
>
>
|
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
struct addrinfo hints, *res, *res0;
char portstr[6];
if (!port) {
/* FIXME: Throw exception */
return nil;
}
if (sock >= 0) {
/* FIXME: Throw exception */
return nil;
}
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
snprintf(portstr, 6, "%d", port);
|
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
struct addrinfo hints, *res;
char portstr[6];
if (!port) {
/* FIXME: Throw exception */
return nil;
}
if ((sock = socket(family, SOCK_STREAM, 0)) < 0) {
/* FIXME: Throw exception */
return nil;
}
memset(&hints, 0, sizeof(struct addrinfo));
|
>
>
>
>
>
|
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
struct addrinfo hints, *res;
char portstr[6];
if (!port) {
/* FIXME: Throw exception */
return nil;
}
if (sock >= 0) {
/* FIXME: Throw exception */
return nil;
}
if ((sock = socket(family, SOCK_STREAM, 0)) < 0) {
/* FIXME: Throw exception */
return nil;
}
memset(&hints, 0, sizeof(struct addrinfo));
|
272
273
274
275
276
277
278
279
280
281
282
|
- close
{
if (sock < 0) {
/* FIXME: Throw exception */
return nil;
}
return self;
}
@end
|
>
>
>
>
|
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
|
- close
{
if (sock < 0) {
/* FIXME: Throw exception */
return nil;
}
if (saddr != NULL)
[self freeMem: saddr];
saddr_len = 0;
return self;
}
@end
|