📄 tcp.h
字号:
/******************************************************************************\ * tcp (header) * ****************************************************************************** * \file * Library for tcp. for win32 and Unix(BSD) * \author : Julien Pilet <leto@calodox.org>, @ngel$ <angel@calodox.org> * * \date : 10-07-1999 *\******************************************************************************/#ifndef _TCP_H_#define _TCP_H_// includes#include <stdio.h>#include <sys/types.h>#ifndef WIN32 #include <sys/socket.h> #include <netdb.h> #include <unistd.h> #include <netinet/in.h> #include <sys/time.h> #include <arpa/inet.h>#else #include <windows.h> #include <winsock.h>#endif#include <string.h>#define EXIT_ERROR 0#define EXIT_OK 1#define DEFAULT_PORT 8787#ifdef __cplusplusextern "C" {#endifextern struct sockaddr_in srv_addr, cli_addr;extern int cli_addr_len ;extern int sSocket; //< Server socketextern char szerror[128];extern int nerror;extern char hostname[128];//! start a Client protocole(TCP) on the server//! \return (0 == correct / -1 error)int tcpstartclient(int port, // port... Blux... char* server); // Server Name //! start a server side TCP protocole//! \return (0 == correct / -1 error)int tcpstartsrv(int port, //Blux... int nnoc); //Number of connections...//! get error and produce an output on the stdin//! \return error code numberint geterror( void );// get error and save the error on a global variable szerror// RETURN (0 == correct / -1 error)int sgeterror( void );// Close the connection// RETURN (0 == correct / -1 error)int tcpstop( void );// Close the socket // Return the in of the (Unix/Win32)int close_socket(int mySock);#ifdef __cplusplus}#endif#endif // _TCP_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -