Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. #if defined WIN32
  5. #include <winsock.h>
  6. #else
  7. #define closesocket close
  8. #include <sys/socket.h>
  9. #include <arpa/inet.h>
  10. #include <unistd.h>
  11. #endif
  12.  
  13. int main(void) {
  14.  
  15. #if defined WIN32
  16.  
  17. WSADATA wsaData;
  18. WORD wVersionRequested;
  19. wVersionRequested = MAKEWORD(2, 2);
  20. int iResult = WSAStartup(wVersionRequested, &wsaData);
  21. if (iResult != 0){
  22. printf("Error at WSAStartup()n");
  23. printf("A usable WinSock DLL cannot be found");
  24. return 0;
  25. }
  26.  
  27. #endif
  28.  
  29. int Mysocket;
  30.  
  31. //***MyCode***
  32.  
  33. closesocket(Mysocket);
  34.  
  35. #if defined WIN32
  36. WSACleanup();
  37. #endif
  38.  
  39. return 0;
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement