00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef _WIN32
00016 #include <sys/types.h>
00017 #include <sys/socket.h>
00018 #include <netdb.h>
00019 #endif
00020
00021 #import "OFStream.h"
00022
00023
00024
00025
00026
00027
00028 #ifdef _WIN32
00029 #define _WIN32_WINNT 0x0501
00030 #include <winsock2.h>
00031 #include <ws2tcpip.h>
00032 #endif
00033
00037 @interface OFSocket: OFStream
00038 {
00039 #ifndef _WIN32
00040 int sock;
00041 #else
00042 SOCKET sock;
00043 #endif
00044 struct sockaddr *saddr;
00045 socklen_t saddr_len;
00046 BOOL eos;
00047 }
00048
00052 + socket;
00053
00057 - setBlocking: (BOOL)enable;
00058
00059 - connectToService: (OFString*)service
00060 onNode: (OFString*)node;
00061 - bindService: (OFString*)service
00062 onNode: (OFString*)node
00063 withFamily: (int)family;
00064 - listenWithBackLog: (int)backlog;
00065 - listen;
00066 - (OFSocket*)accept;
00067 - enableKeepAlives: (BOOL)enable;
00068 - close;
00069 @end