00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _WIN32
00018 # include <sys/types.h>
00019 # include <sys/socket.h>
00020 # include <netdb.h>
00021 #endif
00022
00023 #import "OFStreamSocket.h"
00024
00025 #ifdef _WIN32
00026 # include <ws2tcpip.h>
00027 #endif
00028
00029 @class OFString;
00030
00037 @interface OFTCPSocket: OFStreamSocket
00038 {
00039 BOOL isListening;
00040 struct sockaddr *sockAddr;
00041 socklen_t sockAddrLen;
00042 }
00043
00050 - (void)connectToHost: (OFString*)host
00051 onPort: (uint16_t)port;
00052
00062 - (uint16_t)bindToPort: (uint16_t)port
00063 onHost: (OFString*)host;
00064
00070 - (void)listenWithBackLog: (int)backlog;
00071
00075 - (void)listen;
00076
00081 - (OFTCPSocket*)accept;
00082
00086 - (void)setKeepAlivesEnabled: (BOOL)enable;
00087
00093 - (OFString*)remoteAddress;
00094
00098 - (BOOL)isListening;
00099 @end