SFML community forums

Help => Network => Topic started by: Hamed on February 20, 2013, 12:39:56 pm

Title: Packet with fixed size
Post by: Hamed on February 20, 2013, 12:39:56 pm
Hello,
I want to send "Hello World" to UDP server but with fixed size so I did:
socket.send("Hello World",256,udpServer1,port);
 
It send packet with size 256 byte but it fill empty part with random character but I need blank with in hex show I get 0000.

I use winSniff to check packets structure.
Title: Re: Packet with fixed size
Post by: Laurent on February 20, 2013, 12:51:56 pm
It's not magic, if you want to send a 256 characters long string padded with zeroes, you must create this string.

Sending a string with less characters than the given size causes an undefined behaviour.
Title: Re: Packet with fixed size
Post by: Hamed on February 23, 2013, 04:43:19 am
I have hex code of this package can I convert it to string and send it?
Title: Re: Packet with fixed size
Post by: Laurent on February 23, 2013, 09:37:12 am
You can do whatever you want. If you a have a specific problem, please be more precise about it.