Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

tcp.h

00001 /******************************************************************************\
00002  * tcp (header)                                                               *
00003  ******************************************************************************
00004  * \file 
00005  * Library for tcp. for win32 and Unix(BSD)        
00006  * \author   : Julien Pilet <leto@calodox.org>, @ngel$ <angel@calodox.org>    *
00007  * \date     : 10-07-1999                                                     *
00008 \******************************************************************************/
00009 
00010 #ifndef _TCP_H_
00011 #define _TCP_H_
00012 
00013 // includes
00014 #include <stdio.h>
00015 #include <sys/types.h>
00016 #ifndef WIN32
00017         #include <sys/socket.h>
00018         #include <netdb.h>
00019         #include <unistd.h>
00020         #include <netinet/in.h>
00021         #include <sys/time.h>
00022         #include <arpa/inet.h>
00023 #else
00024         #include <windows.h>
00025         #include <winsock.h>
00026 #endif
00027 #include <string.h>
00028 #define EXIT_ERROR 0
00029 #define EXIT_OK 1
00030 #define DEFAULT_PORT 8787
00031 
00032 #ifdef __cplusplus
00033 extern "C" {
00034 #endif
00035 
00036 extern struct sockaddr_in srv_addr, cli_addr;
00037 extern int cli_addr_len ;
00038 extern int sSocket;     //< Server socket
00039 extern char szerror[128];
00040 extern int nerror;
00041 extern char hostname[128];
00042 
00045 int tcpstartclient(int port,            // port... Blux...
00046                                    char* server);       // Server Name 
00047 
00050 int tcpstartsrv(int port,       //Blux...
00051                                 int nnoc);      //Number of connections...
00052 
00055 int geterror( void );
00056 
00057 // get error and save the error on a global variable szerror
00058 // RETURN (0 == correct / -1 error)
00059 int sgeterror( void );
00060 
00061 // Close the connection
00062 // RETURN (0 == correct / -1 error)
00063 int tcpstop( void );
00064 
00065 // Close the socket 
00066 // Return the in of the (Unix/Win32)
00067 int close_socket(int mySock);
00068 
00069 #ifdef __cplusplus
00070 }
00071 #endif
00072 
00073 #endif // _TCP_H_
00074 

Generated on Fri May 16 13:01:45 2003 for Jelie by doxygen1.2.15