Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [SOLVED]Network question about recv packets  (Read 2293 times)

0 Members and 1 Guest are viewing this topic.

Soul

  • Newbie
  • *
  • Posts: 44
    • View Profile
[SOLVED]Network question about recv packets
« on: February 28, 2013, 02:44:55 pm »
Hey, i have a question about recv packets, can i do it in this style?
i want recv part of a packet to check a packet type and packet action then recv rest of the packet?
ex.
enum packet_type
{
type1 = 0,
type2 = 1,
type3 = 2...
}

then

switch( packet >> packet_type )
{
case : type1
{
packet >> x >> x;
...
}
case : type2
{
packet >> learnskill >> id;
...
}
...
 
?
« Last Edit: March 01, 2013, 03:08:56 pm by Soul »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Network question about recv packets
« Reply #1 on: February 28, 2013, 02:50:50 pm »
Based on what you show, the problem is not about receiving the data, it's just about decoding the packet. So yes, there's no problem doing it this way.
Laurent Gomila - SFML developer

Soul

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: Network question about recv packets
« Reply #2 on: February 28, 2013, 03:12:25 pm »
cool it's a very good information for me :D, so f*ck winsock xD let's do the connection in sfml network
thanks for respond, you can close the topic ^^
sorry for mine grammar :P