Advertisement
Guest User

Untitled

a guest
May 30th, 2011
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. int main ( int argc, char** argv )
  2. {
  3.     CNetwork Network;
  4.  
  5.     sf::Packet ToSend;
  6.     sf::Packet Recieved;
  7.  
  8.     if (/* If you want to connect, you can add this anywhere */)
  9.     {
  10.         Network.Connect(sf::IPAddress(argv[1]));
  11.     }
  12.  
  13.     while (/*main loop*/)
  14.     {
  15.         Network.WaitConnection();
  16.  
  17.         if ( Network.WaitData(&Recieved) )
  18.         {
  19.             // Do something with received data...
  20.         }
  21.  
  22.         if (/*something to send*/)
  23.         {
  24.             // fill ToSend packet...
  25.             if (!Network.SendData(&ToSend))
  26.             {
  27.                 // failed to send...
  28.             }
  29.         }
  30.     }
  31.  
  32.     return 1;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement