ObjFW  Diff

Differences From Artifact [a907635fe9]:

To Artifact [fc3b5a9ea7]:


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
9
10
11
12
13
14
15

16
17
18
19
20
21
22







-







 * the packaging of this file.
 */

#include "config.h"

#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>

#ifndef _WIN32
# include <sys/types.h>
# include <sys/socket.h>
#endif

98
99
100
101
102
103
104
105
106
107

108
109

110
111
112

113
114
115
116
117
118
119
120
121

122
123
124
125
126

127
128
129
130
131
132
133
97
98
99
100
101
102
103



104


105



106








107
108
109
110
111

112
113
114
115
116
117
118
119
120







-
-
-
+
-
-
+
-
-
-
+
-
-
-
-
-
-
-
-

+



-

+







		@throw [OFWriteFailedException newWithClass: isa
						       size: size];

	/* This is safe, as we already checked for -1 */
	return ret;
}

- (void)setBlocking: (BOOL)enable
{
#ifndef _WIN32
#ifdef _WIN32
	int flags;

- (void)setBlocking: (BOOL)enable
	if ((flags = fcntl(sock, F_GETFL)) == -1)
		@throw [OFSetOptionFailedException newWithClass: isa];

{
	if (enable)
		flags &= ~O_NONBLOCK;
	else
		flags |= O_NONBLOCK;

	if (fcntl(sock, F_SETFL, flags) == -1)
		@throw [OFSetOptionFailedException newWithClass: isa];
#else
	u_long v = enable;
	isBlocking = enable;

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

- (int)fileDescriptor
{
	return sock;
}

- (void)close