by Max Foster: L6 Age ~16


Max used the SDL_Net documentation to help him write his AppNetworking and AppSDL units, which he will use for future games. He states in his introductory comments that the AppNetworking unit hides the complicated parts of networking from the programmer and that it provides subroutines to set up a connection and send data quickly and easily. Max has written specialised routines for the transfer of integers, characters and strings. He has written difficult code using the necessary buffers and pointers in his 'engine' units so that his game development will be more straightforward in the future. Max has generously made these available to us all and we recommend that you use them in your own networking programs.

Program NetWorkChat demonstrates the use of some of the TCP subroutines in the SuperMaximo App Engine(c). The following screenshot shows four instances of program Main (which we since renamed NetworkChat) running on a single computer.

NetworkChat in action

NetworkChat in action

Now, with the cross-platform version of March 2013, Raspberry Pi users can chat with PC users. To find the IP address of the Pi you can type ifconfig at the command prompt. On a PC the equivalent command is ipconfig. (You can use automatically generated addresses instead when all the computers are PCs).

NetworkChat running on Arch Linux on the Pi

NetworkChat running on Arch Linux on the Pi

Download here a zip file containing the main code (networkchat.txt, updated cross-platform version), the AppNetworking unit (AppNetworking.pas), the AppSDL unit (AppSDL.pas) and the icon (NetworkChat.ico). You should unzip the files so that all are in the program folder. In order to run the program you will need to use SDL files. (See Getting Started with SDL for download details of SDL.dll and SDL.pas). You can download from the SDL_net 1.2 page of the SDL site. You have probably downloaded already the SDL_Net.pas header file as part of from sourceforge. The program uses the crt unit, so compile it using Lazarus.

Click on the links below to view the code.

Programming - a skill for life!

NetworkChat, PascalPokemon and MrSnugglekins by Max Foster