📄 portsockdef.h
字号:
/***************************************************************************\ portsockdef.h - description ------------------- begin : 06/03/2002 copyright : (C) 2002 by James Martin email : boolean_machine@yahoo.com This header contains definitions for portable network sockets coding. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. \***************************************************************************/ #ifndef PORTSOCKDEF_H#define PORTSOCKDEF_H#ifdef WIN32 /* This is Windoze, so we need Winsock... */ #include <winsock2.h> /* How ya close sockets on a Windoze box. */ #define CLOSE(sd) closesocket(sd)#else /* If not, do it the right way... */ #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <netdb.h> #include <unistd.h> #include <arpa/inet.h> typedef int SOCKET; /* Windoze dummies (a dummy function call looks better than #ifdef's everywhere). */ typedef unsigned short WSAData; #define WSAStartup(foo, bar) !(*bar = foo) #define WSACleanup() /* How ya close sockets on a *nix box. */ #define CLOSE(sd) close(sd)#endif/* IPv4 octet type. */typedef unsigned char OCT;/*typdef these stuctures so the "struct"qualifier is not needed for C declarations.*/typedef struct sockaddr sockaddr;typedef struct sockaddr_in sockaddr_in;typedef struct hostent hostent;#define GSPS_OK 0#define GSPS_NO_SOCK (-1)#define GSPS_NO_HOST (-2)#define GSPS_NO_CON (-3)#define GSPS_INIT_ADDR(sa, h, port) \sa.sin_family = AF_INET; \sa.sin_port = htons(port); \sa.sin_addr.s_addr = *((unsigned long *) (h)->h_addr_list[0]) #endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -