UDP Functions
Putting the UDP funcs into your game
UDP_Send and UDP_Receive
UDP Daemon
UDP Function List

   Some of the UDP_Funcs are in a separate Include- these are the basic send, receive, and Initialise UDP functions (all of the UDP_Funcs could be put into that include). The UDP_Funcs check wether packets have arrived at their destination and resends them if they haven't (ie: no reply after a certain time- determined by 'max_wait.w'). After 'number_resends.w' resends they assume the link is dead and the player is considered offline.
   You can also send Unreliable packets as well (these are just sent out and no checks are made if the packet has arrived or not).
   If it is the Server, it disconnects the player and tells all the other players that that player is offline. If it is a Client it tells the Server and if the Server can't connect to the player, the Server then disconnects the player as above. If the Server can connect to the player then the Client that claimed the other player was offline, is disconnected. It is done this way as a security thing- to stop people cheating by claiming someone is offline (the claims are stored in the player_honesty() array for later checking if the other player is found to be online)! This is for the rare case that two players have a connection to a third, but only one of those players loses connection to the third one. The connection to the Server is the one that is important. I'm going to remove this as it can be got around with packet filtering.
   Comms_Housekeeping does most of the work, and returns wether your've been connected, disconnected, or your connection attempt has been rejected or False if nothing interesting has happened- although I will remove the feedback from it, to clean up the API.
   The Net Protocol Header defines the hex numbers that tell what each packet is, so you can decode the data in each packet. I haven't fully documented the protocol on computer file yet, but it's pretty self-explanatory.
   Currently you get an Enforcer hit everytime you call ReadUDP{}, it seems to be caused by the IoctlSocket{} call. As I've replaced the call by Rodger Light's asm routine, it can only be a bug in Miami, and not in my routines.
   You'll notice I've put in some security measures, ie: it checks if the packet has come from a logged-in host (rather than having a player number in the packet- saves data too), so it stops people sending fake messages to try and cheat. People could still send fake IP (raw) packets if they knew what they were doing.

Back to UDP Lib Index

(c) 2001-2002 Anton Reinauer - Last updated 04-02-2002