Network.h 998 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef Network_H
  2. #define Network_H
  3. #ifdef WIN32
  4. #ifdef _DEBUG
  5. #ifndef _LTMDB
  6. #define _CRTDBG_MAP_ALLOC
  7. #include <stdlib.h>
  8. #include <crtdbg.h>
  9. #define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)
  10. #define new DEBUG_CLIENTBLOCK
  11. #define _LTMDB
  12. #endif
  13. #endif
  14. #define _WINSOCK_DEPRECATED_NO_WARNINGS
  15. #include <WinSock2.h>
  16. #else
  17. #include <netinet/in.h>
  18. #include <arpa/inet.h>
  19. #include <sys/socket.h>
  20. #include <sys/time.h>
  21. #include <unistd.h>
  22. #include <fcntl.h>
  23. #include <iostream>
  24. #define __declspec( x )
  25. #define __int64 long long
  26. #ifndef SOCKET
  27. #define SOCKET int
  28. #define SOCKADDR_IN sockaddr_in
  29. #define ADDR_ANY INADDR_ANY
  30. #define closesocket close
  31. #define PHOSTENT hostent*
  32. #endif
  33. #endif
  34. namespace Network
  35. {
  36. __declspec( dllexport ) void Start( int maxClients );
  37. __declspec( dllexport ) void getHostName( char *name, int bufferLen );
  38. __declspec( dllexport ) char *getHostAddresse();
  39. __declspec( dllexport ) void Exit();
  40. }
  41. #endif