ObjFW  Diff

Differences From Artifact [cffdc41556]:

To Artifact [f9ba7e8037]:


38
39
40
41
42
43
44
45

46
47
48
49
50
51
52
53
54

55
56
57
58
59
60
61
62
63
64
65
66

67
68
69
70
71
72
73

74
75
76
77
78


79
80
81
82
83
84



85
86
87
88
89



90
91
92
93
94
95


96
97
98
99
38
39
40
41
42
43
44

45
46
47
48
49
50
51
52
53

54
55
56
57
58
59
60
61
62
63
64
65

66
67
68
69
70
71
72

73
74
75
76
77

78
79
80
81
82
83
84

85
86
87
88
89
90
91

92
93
94
95
96
97
98
99
100
101
102
103
104
105
106







-
+








-
+











-
+






-
+




-
+
+





-
+
+
+




-
+
+
+






+
+




{
	BOOL			isListening;
	struct sockaddr_storage	*sockAddr;
	socklen_t		sockAddrLen;
}

/**
 * Connect the OFTCPSocket to the specified destination.
 * \brief Connect the OFTCPSocket to the specified destination.
 *
 * \param host The host to connect to
 * \param port The port on the host to connect to
 */
- (void)connectToHost: (OFString*)host
		 port: (uint16_t)port;

/**
 * Bind the socket on the specified port and host.
 * \brief Bind the socket on the specified port and host.
 *
 * \param port The port to bind to. If the port is 0, an unused port will be
 *	       chosen, which can be obtained using the return value.
 * \param host The host to bind to. Use @"0.0.0.0" for IPv4 or @"::" for IPv6
 *	       to bind to all.
 * \return The port the socket was bound to
 */
- (uint16_t)bindToPort: (uint16_t)port
		onHost: (OFString*)host;

/**
 * Listen on the socket.
 * \brief Listen on the socket.
 *
 * \param backlog Maximum length for the queue of pending connections.
 */
- (void)listenWithBackLog: (int)backLog;

/**
 * Listen on the socket.
 * \brief Listen on the socket.
 */
- (void)listen;

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

/**
 * Enable or disable keep alives for the connection.
 * \brief Enable or disable keep alives for the connection.
 *
 * \param enable Whether to enable or disable keep alives for the connection
 */
- (void)setKeepAlivesEnabled: (BOOL)enable;

/**
 * Returns the remote address of the socket. Only works with accepted sockets!
 * \brief Returns the remote address of the socket.
 *
 * Only works with accepted sockets!
 *
 * \return The remote address as a string
 */
- (OFString*)remoteAddress;

/**
 * \brief Returns whether the socket is a listening socket.
 *
 * \return Whether the socket is a listening socket
 */
- (BOOL)isListening;
@end