Changeset 46 in libcf for trunk/include/cf_socket.h
- Timestamp:
- 03/29/13 14:40:25 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/cf_socket.h
r40 r46 13 13 14 14 #include "cf_base.h" 15 15 16 #include <stddef.h> 16 17 17 #ifdef _WIN32 18 # include <WinSock2.h> 19 #else 20 # include <netinet/in.h> 21 # include <sys/socket.h> 22 # include <arpa/inet.h> 23 # include <netdb.h> 24 # include <unistd.h> 25 #endif 18 /** 타임아웃을 설정하지 않음 */ 19 #define CF_SOCKET_NO_TIMEOUT -1 26 20 27 #ifdef _WIN32 28 typedef int socklen_t; 29 #endif // #ifdef _WIN32 21 /** 호스트 정보 */ 22 typedef struct cf_socket_hostinfo { 23 char address[128]; /**< 원격 호스트 주소 */ 24 unsigned short port; /**< 원격 호스트 포트 */ 25 } CF_Socket_HostInfo; 30 26 31 27 #ifdef __cplusplus … … 34 30 35 31 CF_EXPORT CF_BOOL 36 CF_Socket_IsInitialized (void);32 CF_Socket_IsInitialized (void); 37 33 38 34 CF_EXPORT int 39 CF_Socket_Initialize (void);35 CF_Socket_Initialize (void); 40 36 41 37 CF_EXPORT int 42 CF_Socket_Finalize (void);38 CF_Socket_Finalize (void); 43 39 44 40 CF_EXPORT int 45 CF_Socket_Close (const int sock);41 CF_Socket_Close (const int sock); 46 42 47 43 CF_EXPORT int 48 CF_Socket_SetOption (const int sock,49 const int optname,50 const void * optval,51 const size_t optlen);44 CF_Socket_SetOption (const int sock, 45 const int optname, 46 const void * optval, 47 const size_t optlen); 52 48 53 49 CF_EXPORT int 54 CF_Socket_GetOption (const int sock,55 const int optname,56 void * optval,57 size_t * optlen);50 CF_Socket_GetOption (const int sock, 51 const int optname, 52 void * optval, 53 size_t * optlen); 58 54 59 55 CF_EXPORT int 60 CF_Socket_ SetTimeout (const int sock,61 const int timeout);56 CF_Socket_Connect (const char * ip, 57 const unsigned short port); 62 58 63 59 CF_EXPORT int 64 CF_Socket_Connect (const char * ip, 65 const unsigned short port); 60 CF_Socket_ConnectTimeout (const char * ip, 61 const unsigned short port, 62 const int timeout); 66 63 67 64 CF_EXPORT int 68 CF_Socket_Server (const unsigned short port,69 const int backlog);65 CF_Socket_Server (const unsigned short port, 66 const int backlog); 70 67 71 68 CF_EXPORT int 72 CF_Socket_Accept (const int sock,73 struct sockaddr_in * address);69 CF_Socket_Accept (const int sock, 70 CF_Socket_HostInfo * host); 74 71 75 72 CF_EXPORT int 76 CF_Socket_Send (const int sock,77 const void * buf,78 const int len);73 CF_Socket_Send (const int sock, 74 const void * buf, 75 const int len); 79 76 80 77 CF_EXPORT int 81 CF_Socket_Recv (const int sock, 82 void * buf, 83 const int len); 78 CF_Socket_SendTimeout (const int sock, 79 const void * buf, 80 const int len, 81 const int timeout); 82 83 CF_EXPORT int 84 CF_Socket_Recv (const int sock, 85 void * buf, 86 const int len); 87 88 CF_EXPORT int 89 CF_Socket_RecvTimeout (const int sock, 90 void * buf, 91 const int len, 92 const int timeout); 84 93 85 94 #ifdef __cplusplus
Note:
See TracChangeset
for help on using the changeset viewer.