ObjFW  Diff

Differences From Artifact [275bdc16df]:

To Artifact [0fd4ca4245]:


69
70
71
72
73
74
75
76
77
78
79


80
81
82
83
84
85
86

	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_family = AF_UNSPEC;
	hints.ai_socktype = SOCK_STREAM;

	snprintf(portstr, 6, "%d", port);

	if (getaddrinfo(host, portstr, &hints, &res0)) {
		/* FIXME: Throw exception */
		return nil;
	}



	for (res = res0; res != NULL; res = res->ai_next) {
		if ((sock = socket(res->ai_family, res->ai_socktype,
		    res->ai_protocol)) < 0)
			continue;

		if (connect(sock, res->ai_addr, res->ai_addrlen) < 0) {







|
|
|
<
>
>







69
70
71
72
73
74
75
76
77
78

79
80
81
82
83
84
85
86
87

	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_family = AF_UNSPEC;
	hints.ai_socktype = SOCK_STREAM;

	snprintf(portstr, 6, "%d", port);

	if (getaddrinfo(host, portstr, &hints, &res0))
		@throw [OFAddressTranslationFailedException
		    newWithObject: self

			  andNode: host
		       andService: portstr];

	for (res = res0; res != NULL; res = res->ai_next) {
		if ((sock = socket(res->ai_family, res->ai_socktype,
		    res->ai_protocol)) < 0)
			continue;

		if (connect(sock, res->ai_addr, res->ai_addrlen) < 0) {
122
123
124
125
126
127
128
129
130
131
132


133
134
135
136
137
138
139

	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_family = family;
	hints.ai_socktype = SOCK_STREAM;

	snprintf(portstr, 6, "%d", port);

	if (getaddrinfo(host, portstr, &hints, &res)) {
		/* FIXME: Throw exception */
		return nil;
	}



	if (bind(sock, res->ai_addr, res->ai_addrlen) < 0) {
		/* FIXME: Throw exception */
		freeaddrinfo(res);
		return nil;
	}








|
|
|
<
>
>







123
124
125
126
127
128
129
130
131
132

133
134
135
136
137
138
139
140
141

	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_family = family;
	hints.ai_socktype = SOCK_STREAM;

	snprintf(portstr, 6, "%d", port);

	if (getaddrinfo(host, portstr, &hints, &res))
		@throw [OFAddressTranslationFailedException
		    newWithObject: self

			  andNode: host
		       andService: portstr];

	if (bind(sock, res->ai_addr, res->ai_addrlen) < 0) {
		/* FIXME: Throw exception */
		freeaddrinfo(res);
		return nil;
	}