UDP Functions History

Version 2.92 24/09/2008

- Started conversion of UDP Functions and UDP Chat to C.
- UPDHeader split up- Protocols are now in UPDProtocol.h (V2.5)

9/04/04 - Currently getting rid of bugs introduced in V2.91.
- Have added in logfile ability for each program running.
- Have documented some more UDP Library functions

Version 2.91 10/04/04

- UDPHeader is V2.4, UDPFuncs are V2.4.
- Streamlined the incoming data buffer system by removing some unnecessary memory copys. UDPmem is renamed incoming_buffer, incoming_game_data and send_buffer2 have been removed. - #ONLINE_VARIABLE changed to #ONLINE_STATUS.

Version 2.9 04/10/2002

- UDPHeader is V2.3
- Removed Time Synching and Player Info routines from the login process. These instead have been replaced by Function calls, so they can be called at any time by the Server, after a player has been through the login process. This allows much greater flexibility for the programmer, at the cost of a little more complexity.

Version 2.8 9/04/2002

- UDPHeader is V2.2, UDPFuncs are V2.3.
- Get/Set_Variable has been changed to Get/Set_Comms_Variable.
- All global variables in UDP Funcs, used in UDP Chat, are now accessed through Get/Set_Comms_Variable{}
- Dim_Message_Arrays{} changed to Max_Number_Players{}, but unfortunately you can't change the max_number_players yet, as you can't ReDim an array in a Function :/ It will have to wait till it's in a C lib.
- Initialise_Server now takes max_number_players as an additional parameter: Initialise_Server{localhost_name.l,localport.w,max_number_players.w}.
- player_info_buffer is now initialised in Max_Number_Players{}, not in Initialise_UDP{} (temporarily it's initialised in Dims, until Max_Number_Players{} is working).
- Removed auto-port numbering in Initialise_UDP{}, and it now sends back #PORT_BIND_FAILED if it can't bind to a port- a call to Initialise_Server{} and Connect_to_Server{} passes the code back if it fails. UDP_Chat now does the auto-port numbering (where it should be- not in the lib) for testing purposes on localhost.
- While changing the auto-port numbering, I fixed a bug in Initialise_UDP{} that allowed you keep an already online socket- this was code from an earlier design. Also, I found that Offline_Cleanup{} wasn't calling Close_UDP{} to close down the socket, socket lib and buffers (it was only working because of the above old design :).
- Get_Comms_Data{} has been folded into Decode_Packet{}, and Decode_Packet{} has been renamed Get_Comms_Data{}. It now passes back either #NO_DATA_WAITING (0), or the address of the data buffer if some data is there.

Version 2.79 22/02/2002

- UDPHeader is V1.9, UDPFuncs are V2.1.
- Get_Ascii_Address{} moved to UDP_Chat as it wasn't used in the UDP Funcs.
- ascii_host_string.s entry removed from .player_info Newtype, as it wasn't used.
- Localhost_Name{} has been moved to UDP_Chat.
- Get_Host_By_Name{} now takes a pointer to a string as a parameter, instead of a string.
- Initialise_Server{) now takes a pointer to the localhost name as well as to the localhost port, instead of just to the localhost port.
- Connect_to_Server{} now takes a pointer to the hostname as a parameter instead of a string (which was ignored anyway), and now also takes a pointer to the localhost name and the localhost port.
- Initialise_UDP{} now takes a pointer to the localhost name as well as to the localhost port, instead of just to the localhost port.

Version 2.78 20/02/2002

- UDPHeader is V1.8, UDPFuncs are V2.0
- Comms_Housekeeping{} no longer returns comms information, it has been transfered to the Get/Set_Comms_System_Information{} system to tidy up the API.
- Get_Game_Data{} has been renamed Get_Comms_Data{} and now just returns wether any Comms Data is waiting or not.
- All the Comms code has been taken out of .Main and put in Comms_Work{} (in UDP_Chat), which calls Get_Comms_Data{} in a repeat-until, so all waiting comms information is delt with. It also calls Comms_Housekeeping{} once per frame.

Version 2.77 18/02/2002

- UDPFuncs are V1.9.
- Lots of tidying up done
- Init_Gui Gosub is replaced by UDP_Chat_Init{} Statement, and the SetInt code for the system time, is now above .Main (as it can't be in a Statement/Function).
- Add_Comms_System_Information has been renamed to Set_Comms_System_Information to be internally consistent and consistent with Java naming practices.

Version 2.76 26/03/2001

- UDPHeader is V1.7, UDPFuncs are V1.8.
- Constants for new Comms System messages are complete, and the new (stringless) Add and Get_Comms_System_Information functions, which replace the Security_Warning{}, Read_Security_Warning{}, Comms_Debug{} and Read_Comms_Debug_Messages{}, have been finished, and all the comm system information and error codes have been converted to the new routines.
- Added Links Page to docs.

Version 2.75 8/04/2000

- UDPHeader is V1.5, UDPFuncs are V1.7.
- Several login bugs were sorted. The game end routine was removed- the player disconnect routine is used instead- I had two routines doing similar things -urrgg!
- Game data can now be sent Client-Server as well as Peer-To-Peer now. Check out .Main (in Case #REL_UNOR_CS_PACKET, and Case #REL_UNOR_CS_PACKET) for an example of passing on Client data through the Server, as it's not done automatically by my functions (so you can check for collisions, cheating etc first). Click on button `6' to toggle between Peer-To-Peer, and Client-Server.
- Added new variable `protocol'. Either set to #CLIENT_SERVER, or #PEER_TO_PEER, before the Server is started (this is set in UDP_Chat with button `6')- the Server will then tell connecting Clients what protocol is being used by the Server- then this variable is set on the Client, so the Client knows what protocol to use.
Note: you can send game data #PEER_TO_PEER if you want, even if the game's #CLIENT_SERVER (and vice-versa)- the `protocol' is a guide only, it doesn't force data to be sent any way. Also you can send data Reliably and Unreliably, as well as #CLIENT_SERVER and #PEER_TO_PEER, so data can be sent four different ways:

   #REL_UNOR_PTP_PACKET ; Reliably and Peer-To-Peer
   #REL_UNOR_CS_PACKET ; Reliably and Client-Server
   #UNREL_PTP_PACKET ; Unreliably and Peer-To-Peer
   #UNREL_CS_PACKET ; Unreliably and Client-Server

   Note: the UNOR bit- that's a set up for later, as you will be able to receive packets in the order they were sent (Ordered), or as they are at the moment (Unordered). This will only be for Reliable packets, as it wouldn't make any sense to have Ordered Unreliable packets!
Note: Some small interface changes are all that need to be done for V2.8.

Version 2.7 16/01/2000

- UDPHeader is V1.4, UDPFuncs are V1.6- Net protocol header is now in with UDPHeader.
- This is an optimised version of V2.6, where nearly all the string work is replaced by buffers and pointers (all Unreliable packet work is done entirely with buffers now).
- Fixed the bug introduced in V2.6, where a Client would be disconnected after a few seconds, after a second (or more) login(s).
- Data from Reliable and UnReliable Packets is now returned as a pointer to a buffer with new a Function Get_Game_Data{}, so no more using Security_Warning{}. :)
- It has Rodger Light's assembler bsdsocket access put in, instead of the Blitz lib, so you can now start the program without Miami needing to be running first.
- This documentation changed to HTML, to make things easier.

Version 2.6 25/08/1999

- Changed the directory name to UDP_Chat instead of UDPtest, as it's no longer just a small test program ;-)
- Changed packet numbering for Reliable packets to a two-dimensional array (player,message), so packets to each player are tracked separately, instead of all messages being in one array. Overall this has sped things up slightly, and has made the code much tidier in places. Also, I can now easily put in checking for out-of-order incoming packets, and ask for a resend.
- Added Putting the UDP Funcs into your game item under the UDP Funcs section- about bloody time! :)
- Net_protocol_header is V0.6, UDPHeader is V1.3, UDPFuncs are V1.5
- the UDP socket buffer is now cleared when reconnecting.
- Added in 'player_info.info' array to store information for sending to other players, so it's not hard-coded into the Funcs anymore. See Putting the UDP funcs in your game for details.
- The Client's system time is now synched with the Server's (a fiendish bit of coding that was! :) The system time can be accessed on any machine by the global variable `system_time.l'. Button '3' now prints out your current system time.
- The parameters passed to Send_Reliable_Message are now: Send_Reliable_Message(address.l,data_length.w,player.w,protocol,ordering) and Send_Unreliable_Message(address.l,data_length.w,player,protocol) for Send_Unreliable_Message. This is a setup for later optimisations I'll be doing. So now the address and length of memory to be sent is passed instead of the String itself.
Also I've set the Functions up to allow for the Client-Server protocol in Unreliable messages (it's also set up in Reliable), and to allow you to specify wether Reliable packets have to be received ordered or can be received unordered. Neither of these additions have been implemented yet though.
See Putting the UDP funcs into your game for more details.
- Note the Arexx routines cause an Enforcer hit, and the ReadUDP Function causes a couple- I'll have a look at them soon! :)

Version 2.5 14/06/1999

- Shifted LocalHost: button to the left to allow for longer localhost names.
- You can now send and receive Unreliable messages. I've added the Function Send_Unreliable_Message. Decode_Packet now recognises unreliable packets and sends them to Security_Warning to be printed out.
- Button 7 now toggles between sending Reliable and Unreliable messages. Any sent unreliable messages now have SU at the beginning of the line, and any received unreliable messages have RU at the beginning.
- Fixed a bad bug- well bad programming I'd done early on actually. Send_Reliable_Message was changing last_message_number at certain times, when only Find_Next_Message should have been dealing with it- naughty!
- UDP_Header is V1.2, the net protocol header is now V0.5
- I've changed Security_Warning and Comms_Debug, so they now put the messages into arrays rather than calling Print_String. Instead you can get the messages by calling either Read_Security_Warning, or Read_Comms_Debug_Messages which return either a message or empty string "", if there's no more messages waiting to be printed out.
- Print_String has been put with the Game functions, so now you can cut and paste all the UDP stuff into your program in one section.
- Added some more Theory to the Guide.

Version 2.4 26/4/1999

- Changed Exit - I took all the UDP stuff out of it and put it into Close_UDP, in UDP_Funcs- Exit now calls Close_UDP instead. I took all the non comms stuff out of Comms_Housekeeping and put it into General_Housekeeping. I've added in lots of constants like #ONLINE, #SERVER, #HIGH etc, to make things easier to read and understand.
- All the Functions, Variables/Constants and Dims have been separated into Game (specific to UDP_Chat and can be easily changed for your game), and UDP (specific only to the UDP Functions and independant of your game).
- Print_String is before the UDP Functions, but when I change Security_Warning and Comms_Debug to be GUI independant, it can be put with the Game Functions.
- All Print_String calls in the Funcs have been replaced with Security_Warning or Comms_Debug calls- they are called with different levels of degree, so you can just, for example print out System messages or all Security messages (from High priority to Low), by changing the variables `security' and `comms_debug_level'. So now it's much easier to put the UDP_Funcs into your game, as I've almost fully made the UDP_Funcs independant of the GUI.
- Added checking in Decode_Packet, to make sure that we should be able to receive the current packet in our current online state.
- Changed #DEBUG TO #COMMS_DEBUG. Comms_Housekeeping now returns wether we have been connected, disconnected or our connection attempt was rejected.
#MAX_NUMBER_PLAYERS has been changed to a variable (max_number_players), to allow user to change the maximum number of allowed players (the function is is done, but I haven't written a GUI example yet).
- Security_Warning has been moved in with the other UDP Funcs, along with Comms_Debug- at the moment they print to the GUI, but soon I will have them putting their messages into arrays, to allow them to be independant of the GUI. Added #SERVER_NUMBER=1, as the #SERVER number is changed to allow for the added #ATTEMPTING_TO_CONNECT state. A few other changes are made for this as well.
- UDP_Funcs is now V1.4. UDP_Header is V1.1 .
- Fixed a couple of small bugs in Requested_Connection, and changed it's reply for a failed connection attempt to an unreliable message (WriteUDP).
- Fixed a couple of small bugs in Decode_Packet, and re-arranged it a bit to make in independant of the GUI. The call to Read_UDP is now done from Decode_Packet, instead of Comms_Housekeeping.
- Window_Events had a couple of disconnect bugs and it's been changed to allow for the #ATTEMPTING_TO_CONNECT status. General_Housekeeping prints out the lag times now.
- UDP_Chat no longer starts up being able to act as Server, you have to put it in Server mode (as you would in a game) first- there's a Function, Initialise_Server to do it, and a button in UDP_Chat to put you in Server mode. Also there's a Disconnect button to disconnect you from the game if you're a Client, and to close down the game and take you out of Server mode if you're the Server- this done with the Disconnect_From_Game Function.
- The Delay buttons are now changed to button 1: (Delay 1 second), and 2: (Delay 80 seconds), also button 8: pauses (freezes) and unpauses UDP_Chat.
- It prints `Me' in the lag time area at your player number, if you're a Client and Serv in the player 1 position if you're acting as Server.
- All the Game Functions have been separated out and put together after the UDP_Funcs. The UDP Newtypes have been put into UDP_Header and the Game variables, constants, and Dims have been separated from the UDP ones and put above the Game Functions. When I fix Security_Warning and Comms_Debug I can put Print_String in with the Game Functions, so all the UDP stuff will be together, so all you'd have to do to put them into your game is copy the entire UDP section and then paste it above your own Functions! All the UDP Functions could be put into the UDP_Funcs include if you didn't want them in your program.

Version 2.3 7/3/1999

- I've put in the auto-disconnect code, for when a player stops responding. If a player can't communicate when another player it tells the server this- then the Server checks this fact and tells all the players if this is true. 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. If the server can communicate with the player that's thought to be offline, then the player that initiated the call gets disconnected instead. This is just some simple security, to stop cheating by getting the other person disconnected.
- I've tidied up the main loop and taken most stuff out of it- most of the work is now done by the Comms_Housekeeping Function. It's now much easier to slot these functions into your game.
- Added the Clear_Player_Arrays Statement to re-initialise a disconnected player's data.
- Fixed some disconnecting bugs, and now Requested_Connection checks wether the host and port are already connected (it was possible before to let a host log in twice- if you got the timing wrong!)
- Added Security_Warning to allow people to have security messages printed out in their game- you can chose all, medium, or only serious security warnings.
- Some repeated code in Comms_Housekeeping and Acknowledge_Packet has been shifted to Resend_Message.

Version 2.2 14/11/1998 (internal version- not released)

- The disconnect code has been put in, and I tidied up the Decode_Packet and Requested connection functions (no more passing variables between them through Global variables- naughty :).
- Also I've changed the Packet protocol a bit- all packets now have a packet number (.l) in the front, wether they need it or not, as it makes the encoding and decoding of packets much simpler.
- Acknowledge_Packet now checks wether the packet number is in correct bounds to prevent it getting in a loop, if a bad packet is received.
- If the Server closes, it sends the #GAME_END message to all players, if a player closes, it sends #CP_REQ_PLAYER_DISCONNECT with it's player number to the Server, then the Server informs all the players (including the one that sent the disconnect message) that the player has quit, then the player quits when it receives the disconnect message with it's player number.
- Once a Client or Server has started to quit, it will quit after a certain time-out, even if it doesn't get all the responses it required.

Version 2.1 02/10/1998

- Fixed the dead link bug- if after 5 resends there's no reply, it now acknowledges that packet and stops resending- ( Acknowledge_Packet(message_number) on line 649 should have been Acknowledge_Packet(last_message_number) )- doh
- Put docs into AmigaGuide- yay :-) - and added some things to the `Things to Do' list.

Version 2.0 27/07/1998

- Changed printing of Ping times, so they are now printed out correctly for each player, and you can now tell what your player number now is (`Me' is printed in place of your Ping time). Before it just printed out the Ping time of the last packet received. The Server is always Player 1. I fixed a bug which was numbering the clients wrongly, at the same time.
- Put in a ARexx interface, so you can log into a Server from AmiComSys, by passing the host address to UDP_Chat from AmiComSys (through a small Rexx program).
- The Function Connect_UDP has been renamed to the more logical Initialise_UDP, as it doesn't actually connect to anything. It now closes the bsdsocket.library in Initialise_UDP instead of at the end of the program- Paul had done this in his TCP_Funcs, but I hadn't transfered his code across properly. :-/
- I renamed the programs to their actual version number, rather than the quick filename I gave them (ie: UDP_ChatV1.9.bb2, rather than UDP_Chat4.bb2)- doh!
- Changed Close_UDP to Exit and put it back in UDP_Chat. It now deallocates the receive memory buffer (UDP_mem.l) allocated in UDPHeader.bb2, and closes the Rexxport and UDP socket if they've been opened, (tidier than having it all at the end). So you can just call Exit to exit from anywhere (with an error string if needed), rather than have those naughty Gotos! :) Initialised `sock.l' to -1 so Exit routine can work.
- Added in a #DEBUG constant to switch on debug info, and allow multiple copies of UDP_Chat on one machine (currently all debug info is still printed out).
- Changed default Port number to 27,272- (3,001 was too low for practical use). Put `ypos' above `GoSub Init_Gui', so can now call Exit from Init_Gui.
- Added this History File!

Version 1.9 24/04/1998

- Original Aminet release. Several bugs known, and a several features not yet implemented.

Back to UDP Lib Index

(c) 2008 Anton Reinauer - Last updated 24-09-2008