1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
-
-
+
+
+
|
/*
* Copyright (c) 2008 - 2009
* Jonathan Schleifer <js@webkeks.org>
*
* All rights reserved.
*
* This file is part of libobjfw. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE included in
* the packaging of this file.
*/
#import "OFSocket.h"
#import "OFString.h"
/**
* The OFTCPSocket class provides functions to create and use sockets.
*/
@interface OFTCPSocket: OFSocket {}
/**
* \return A new autoreleased OFTCPSocket
*/
+ tcpSocket;
/**
* Initializes an already allocated OFTCPSocket.
*
* \return An initialized OFTCPSocket
*/
- init;
/**
* Connect the OFTCPSocket to the specified destination.
*
* \param host The host or IP to connect to
* \param port The port of the host to connect to
* \param service The service on the node to connect to
* \param node The node to connect to
*/
- connectTo: (const char*)host
onPort: (uint16_t)port;
- connectToService: (OFString*)service
onNode: (OFString*)node;
/**
* Bind socket to the specified address and port.
* Bind socket on the specified node and service.
*
* \param host The host or IP to bind to
* \param port The port to bind to
* \param service The service to bind
* \param node The node to bind to
* \param protocol The protocol to use (AF_INET or AF_INET6)
*/
- bindOn: (const char*)host
withPort: (uint16_t)port
andFamily: (int)family;
- bindService: (OFString*)service
onNode: (OFString*)node
withFamily: (int)family;
/**
* Listen on the socket.
*
* \param backlog Maximum length for the queue of pending connections.
*/
- listenWithBackLog: (int)backlog;
|