ObjFW  Diff

Differences From Artifact [6c14a9bc26]:

To Artifact [4f744ac404]:


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
57
58
59
60
61
62
63

/*
 * Headers for Win32
 *
 * These must be imported after objc/Object and thus OFObject!
 */
#ifdef _WIN32

#import <winsock2.h>
#import <ws2tcpip.h>
#endif

/**
 * The OFTCPSocket class provides functions to create and use sockets.
 */
@interface OFTCPSocket: OFObject <OFStream>
{

	int	  sock;



	struct	  sockaddr *saddr;
	socklen_t saddr_len;
}






/**
 * Initializes an already allocated OFTCPSocket.
 *
 * \return An initialized OFTCPSocket
 */
- init;

- free;
- setSocket: (int)socket;
- setSocketAddress: (struct sockaddr*)sockaddr
	withLength: (socklen_t)len;

/**
 * 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
 */







>









>

>
>
>




>
>
>
>
>








<
<
<







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
57
58
59
60
61
62
63



64
65
66
67
68
69
70

/*
 * Headers for Win32
 *
 * These must be imported after objc/Object and thus OFObject!
 */
#ifdef _WIN32
#define _WIN32_WINNT 0x0501
#import <winsock2.h>
#import <ws2tcpip.h>
#endif

/**
 * The OFTCPSocket class provides functions to create and use sockets.
 */
@interface OFTCPSocket: OFObject <OFStream>
{
#ifndef _WIN32
	int	  sock;
#else
	SOCKET	  sock;
#endif
	struct	  sockaddr *saddr;
	socklen_t saddr_len;
}

/**
 * This needs to be called before any socket can be used.
 */
+ (void)startup;

/**
 * Initializes an already allocated OFTCPSocket.
 *
 * \return An initialized OFTCPSocket
 */
- init;

- free;




/**
 * 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
 */