ObjFW  Diff

Differences From Artifact [cbc64c1780]:

To Artifact [275bdc16df]:


57
58
59
60
61
62
63
64
65


66
67
68
69
70
71
72
73
74
57
58
59
60
61
62
63


64
65


66
67
68
69
70
71
72







-
-
+
+
-
-








- connectTo: (const char*)host
     onPort: (uint16_t)port
{
	struct addrinfo hints, *res, *res0;
	char portstr[6];

	if (!port) {
		/* FIXME: Throw exception */
	if (!port)
		@throw [OFInvalidPortException newWithObject: self];
		return nil;
	}

	if (sock >= 0)
		@throw [OFAlreadyConnectedException newWithObject: self];

	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_family = AF_UNSPEC;
	hints.ai_socktype = SOCK_STREAM;
107
108
109
110
111
112
113
114
115


116
117
118
119
120
121
122
123
124
105
106
107
108
109
110
111


112
113


114
115
116
117
118
119
120







-
-
+
+
-
-







-    bindOn: (const char*)host
   withPort: (uint16_t)port
  andFamily: (int)family
{
	struct addrinfo hints, *res;
	char portstr[6];

	if (!port) {
		/* FIXME: Throw exception */
	if (!port)
		@throw [OFInvalidPortException newWithObject: self];
		return nil;
	}

	if (sock >= 0)
		@throw [OFAlreadyConnectedException newWithObject: self];

	if ((sock = socket(family, SOCK_STREAM, 0)) < 0) {
		/* FIXME: Throw exception */
		return nil;