h31ix

Untitled

Jul 12th, 2012
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <winsock2.h>
  4. #include <ws2tcpip.h>
  5. #include <stdio.h>
  6.  
  7. #include <iphlpapi.h>
  8. #include <icmpapi.h>
  9. #include <stdio.h>
  10.  
  11. #pragma comment(lib, "Ws2_32.lib")
  12.  
  13. int main()
  14. {
  15. SOCKET sock = INVALID_SOCKET;
  16. sock = socket(AF_INET,SOCK_STREAM, 0);
  17.  
  18. sockaddr_in serverAddress;
  19. serverAddress.sin_family=AF_INET;
  20. serverAddress.sin_port=48888;
  21. serverAddress.sin_addr.s_addr=inet_addr("217.23.13.143");
  22.  
  23. connect(sock, (struct sockaddr*)&serverAddress, sizeof(struct sockaddr));
  24. if(sock != INVALID_SOCKET)
  25. {
  26. printf("The server is up!\n");
  27. }
  28. else
  29. {
  30. printf("The server seems to be offline.\n");
  31. }
  32. std::getchar();
  33. }
Advertisement
Add Comment
Please, Sign In to add comment