Advertisement
Guest User

sfml networking

a guest
Feb 13th, 2012
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. void Game::Receive()
  2. {
  3.     sf::Packet Packet;
  4.     sf::IPAddress IP;
  5.     unsigned short port;
  6.  
  7.     Listen.Receive(Packet, IP, port);
  8.  
  9.     int PType = -1;
  10.     Packet >> PType;
  11.     std::cout << "Packet Received! " << IP << " " << PType << std::endl;
  12.  
  13.     if(IP != "255.255.255.255")
  14.     {
  15.         switch (PType)
  16.         {
  17.         // Handle data
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement