SFML community forums

Help => Network => Topic started by: Soul on February 28, 2013, 02:44:55 pm

Title: [SOLVED]Network question about recv packets
Post by: Soul 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;
...
}
...
 
?
Title: Re: Network question about recv packets
Post by: Laurent 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.
Title: Re: Network question about recv packets
Post by: Soul 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