How to know if UDP message was received?
Blitz3D Forums/Blitz3D Programming/How to know if UDP message was received?
| ||
How do you know if your UDP message was recieved? If you keep sending the message until you get a confirmation message back youll have to confirm the confirm ad infinitum. So how do you make sure the message was received? |
| ||
You would probably need a time out system of some sort. Send a unique ID with the packet. The computer that sent the packet will wait x amount of millisecs for confirmation. If it doesn't receive it, then it will resend. If the computer receiving the packet gets two, then disregard the packet. If your using UDP however, you'll probably be using it for a fast game, so missed packets are something the other end needs to cope with, to keep the game moving. |
| ||
How would I create unique number ID's? I would have to send messages to other computers to tell them not to use that number and they might not get the message.. I need a reliable way of saying 'this player has fired a bullet' but TCP is far too slow for that, |
| ||
Well, each computer should start on the same number. Compare the packet number sent, to the clients count. If they don't match up you have lost a packet. Alternatly, try using one of the free libs for networking. RottNet worked well for me and it had reliable packets built in :o) |
| ||
yeh I found that on the blitz website using google but the download was down, also blitzplay is still on the old blitzcoder site and not the new codersworkshop site, installing a whole network library could be a pain, Knet library is also a possibility During tests I found that 'unreliable' directplay packets were actually very reliable, 50 sends and no dropped packets |
| ||
If you want to use UDP for your gamming perhaps you should look at other libraries (instead of in built udp sockets) like blitzplay (not anymore supported) or my new wrapper of RakNet (this rocks!)!!! |
| ||
Nah , use TCP.. |
| ||
Ok Ill check out RAknet thanks, TCP TOO SLOW-xzider |
| ||
All TCP messages are reliable, so you could somehow combine the two. Use UDP for non-relaible messages, and TCP for reliable ones. |
| ||
I believe TCP hangs though if the message isn't received... There definetly was a reason I stopped using it. |
| ||
Blitzplay is no longer supported????? WTH! I just bought that about 9 months ago! No wonder why people stay away from indie developers for tools, they never stick with stuff... |
| ||
TCP does not hang. You can check the stream for data and just go on if there's none. You can easily use TCP/IP instead of UDP. You still have to do some kind of dead reckogning as both UDP and TCP/IP packets will get severely delayed over the internet :) |
| ||
the person sending the tcp message has their game hang |
| ||
thought so :o) |