Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. #include <SDL2/SDL_net.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     if( SDL_Init(SDL_INIT_EVERYTHING) != 0 )
  10.     {
  11.         cout << "Failed to initialize SDL: " << SDL_GetError() << endl;
  12.         exit(-1);
  13.     }
  14.     atexit(SDL_Quit);
  15.  
  16.     if( SDLNet_Init() != 0 )
  17.     {
  18.         cout << "Failed to initialize SDL Net: " << SDLNet_GetError() << endl;
  19.         exit(-1);
  20.     }
  21.     atexit(SDLNet_Quit);
  22.  
  23.     IPaddress ip;
  24.     SDLNet_ResolveHost(&ip, "0.0.0.0", 12000);
  25.  
  26.     TCPsocket socket = SDLNet_TCP_Open(&ip);
  27.     if( socket == NULL )
  28.         cout << SDLNet_GetError() << endl;
  29.  
  30.     cout << SDLNet_ResolveIP(&ip) << endl;
  31.  
  32.     SDLNet_TCP_Close(socket);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement