Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Network
»
[Solved] receiving multiple packets
Print
Pages: [
1
]
Author
Topic: [Solved] receiving multiple packets (Read 2372 times)
0 Members and 1 Guest are viewing this topic.
MarcuzPwnz
Jr. Member
Posts: 77
[Solved] receiving multiple packets
«
on:
March 09, 2013, 09:13:32 am »
Hey there! I have been playing around with the networking in SFML and I have come across a problem, I have spent a good half hour trying to figure this out, by changing code and reading documentation and still I'm stuck.
So here's a problem. My server receives the first packet sent by the client fine, but as soon as the client sends another packet the server extracts the data from the second packet but when I cout the value of the extracted packet it's the same as the first. So I put in an if statement to check if the packet had been read and it turns out the second packet isn't even being read at all. (From what I understand at least)
Server code:
http://pastebin.com/4DJbBMJq
Client code:
http://pastebin.com/gdur9qvf
Would anyone be able to point me in the right direction or explain what I am doing wrong? it would be much appreciated.
Thank you.
«
Last Edit: March 09, 2013, 09:33:28 am by MarcuzPwnz
»
Logged
Laurent
Administrator
Hero Member
Posts: 32498
Re: Problem receiving multiple packets
«
Reply #1 on:
March 09, 2013, 09:28:56 am »
On client side, you always append data to the same packet (which grows at every iteration of the loop, keeping the old data at the beginning), instead of creating a new one every time.
Logged
Laurent Gomila - SFML developer
MarcuzPwnz
Jr. Member
Posts: 77
Re: Problem receiving multiple packets
«
Reply #2 on:
March 09, 2013, 09:32:51 am »
Thank you very much Laurent.
I can't believe I didn't notice that. -.-
Logged
Print
Pages: [
1
]
SFML community forums
»
Help
»
Network
»
[Solved] receiving multiple packets