ObjFW  Check-in [f847f82b75]

Overview
Comment:Make OFSocket a class cluster.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f847f82b75f5361c514d47ae46dbfcdeac4222192fec4eaa1884e9287a85533d
User & Date: js on 2009-06-09 20:44:54
Other Links: manifest | tags
Context
2009-06-09
20:47
Rename -[append:] to -[appendString:]. check-in: 9863810eba user: js tags: trunk
20:44
Make OFSocket a class cluster. check-in: f847f82b75 user: js tags: trunk
20:10
Move documentation of mutating methods.
Mutating methods are now documented in the mutable class.
check-in: 41974cf38d user: js tags: trunk
Changes

Modified src/OFSocket.h from [2c2229f73b] to [69355d01ce].

51
52
53
54
55
56
57











58
 */
+ socket;

/**
 * Enables/disables non-blocking I/O.
 */
- setBlocking: (BOOL)enable;











@end







>
>
>
>
>
>
>
>
>
>
>

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
 */
+ socket;

/**
 * Enables/disables non-blocking I/O.
 */
- setBlocking: (BOOL)enable;

- connectToService: (OFString*)service
	    onNode: (OFString*)node;
- bindService: (OFString*)service
       onNode: (OFString*)node
   withFamily: (int)family;
- listenWithBackLog: (int)backlog;
- listen;
- (OFSocket*)accept;
- enableKeepAlives: (BOOL)enable;
- close;
@end

Modified src/OFSocket.m from [e3b5644b59] to [f493de3de8].

117
118
119
120
121
122
123













































124

	if (ioctlsocket(sock, FIONBIO, &v) == SOCKET_ERROR)
		@throw [OFSetOptionFailedException newWithClass: isa];
#endif

	return self;
}













































@end







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169

	if (ioctlsocket(sock, FIONBIO, &v) == SOCKET_ERROR)
		@throw [OFSetOptionFailedException newWithClass: isa];
#endif

	return self;
}

- connectToService: (OFString*)service
	    onNode: (OFString*)node
{
	@throw [OFNotImplementedException newWithClass: isa
					   andSelector: _cmd];
}

- bindService: (OFString*)service
       onNode: (OFString*)node
   withFamily: (int)family
{
	@throw [OFNotImplementedException newWithClass: isa
					   andSelector: _cmd];
}

- listenWithBackLog: (int)backlog
{
	@throw [OFNotImplementedException newWithClass: isa
					   andSelector: _cmd];
}

- listen
{
	@throw [OFNotImplementedException newWithClass: isa
					   andSelector: _cmd];
}

- (OFSocket*)accept
{
	@throw [OFNotImplementedException newWithClass: isa
					   andSelector: _cmd];
}

- enableKeepAlives: (BOOL)enable
{
	@throw [OFNotImplementedException newWithClass: isa
					   andSelector: _cmd];
}

- close
{
	@throw [OFNotImplementedException newWithClass: isa
					   andSelector: _cmd];
}
@end

Modified src/OFTCPSocket.h from [c2014cc1a4] to [cd27a12d0a].

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
 */
- listen;

/**
 * Accept an incoming connection.
 * \return An autoreleased OFTCPSocket for the accepted connection.
 */
- (OFTCPSocket*)accept;

/**
 * Enable or disable keep alives for the connection.
 */
- enableKeepAlives: (BOOL)enable;

/**
 * Closes the socket.
 */
- close;
@end







|











48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
 */
- listen;

/**
 * Accept an incoming connection.
 * \return An autoreleased OFTCPSocket for the accepted connection.
 */
- (OFSocket*)accept;

/**
 * Enable or disable keep alives for the connection.
 */
- enableKeepAlives: (BOOL)enable;

/**
 * Closes the socket.
 */
- close;
@end

Modified src/OFTCPSocket.m from [48bd51099f] to [44f2d9c515].

266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
	if (listen(sock, 5) == -1)
		@throw [OFListenFailedException newWithClass: isa
						  andBackLog: 5];

	return self;
}

- (OFTCPSocket*)accept
{
	OFTCPSocket *newsock;
	struct sockaddr *addr;
	socklen_t addrlen;
	int s;

	newsock = [OFTCPSocket socket];







|







266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
	if (listen(sock, 5) == -1)
		@throw [OFListenFailedException newWithClass: isa
						  andBackLog: 5];

	return self;
}

- (OFSocket*)accept
{
	OFTCPSocket *newsock;
	struct sockaddr *addr;
	socklen_t addrlen;
	int s;

	newsock = [OFTCPSocket socket];

Modified tests/OFTCPSocket/OFTCPSocket.m from [7176d08840] to [c7b8be1093].

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{
	uint16_t port;
	OFString *service;

	srand(time(NULL));

	@try {
		OFTCPSocket *server = [OFTCPSocket socket];
		OFTCPSocket *client = [OFTCPSocket socket];
		OFTCPSocket *accepted;
		char buf[7];

		puts("== IPv4 ==");
		port = get_port();
		service = [OFString stringWithFormat: @"%d", port];

		[server bindService: service







|
|
|







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{
	uint16_t port;
	OFString *service;

	srand(time(NULL));

	@try {
		OFSocket *server = [OFTCPSocket socket];
		OFSocket *client = [OFTCPSocket socket];
		OFSocket *accepted;
		char buf[7];

		puts("== IPv4 ==");
		port = get_port();
		service = [OFString stringWithFormat: @"%d", port];

		[server bindService: service