Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

trucknet/unp.h

Go to the documentation of this file.
00001 //functions to simplify winsock
00002 //link against WSOCK32.LIB
00003 
00004 #ifndef unp__
00005 #define unp__
00006 
00007 #include <stdio.h>
00008 
00009 
00010 
00011 #if defined(__WIN32__)
00012 #include <winsock2.h>
00013 #define sleep(n) Sleep(n * 1000);
00014 #define socklen_t int
00015 
00016 #else
00017 #include <sys/socket.h>
00018 #include <netinet/in.h>
00019 #include <arpa/inet.h>
00020 #include <errno.h>
00021 #include <netdb.h>
00022 #define SOCKET int
00023 
00024 #endif//_WIN32
00025 
00026 void err_sys(const char *msg);
00027 
00028 SOCKET SocketTCP();
00029 SOCKET SocketUDP();
00030 struct hostent* Gethostbyname(const char* name);
00031 int Connect(SOCKET s,const struct sockaddr_in *name);
00032 void Sockaddr_url(struct sockaddr_in *sa, const char *URL, const u_short sin_port);
00033 void Sockaddr_ip(struct sockaddr_in *sa, const char *IP, const u_short sin_port);
00034 SOCKET Accept_server(SOCKET s,struct sockaddr_in *sa);
00035 void Bind_server(SOCKET s,short port);
00036 void Listen(SOCKET s);
00037 void LocalSocketPair(int type, int protocol, SOCKET sockets[2]);
00038 
00039 
00040 #endif //unp__

Generated on Fri Sep 1 14:25:54 2006 for Raptor by  doxygen 1.4.4