Overview of Networking

On this website there is networking code in these languages and dialects:
  • Object Pascal (in Delphi and Lazarus);
  • Smart Pascal;
  • Oxygene for Java;
  • RemObjects C# for Java.
  • JavaScript
This page provides links so that you can make comparisons more easily and decide which material could be most useful to you when you use networking in your own applications.

Downloading text files from a website

In this section "text file" comprises files including HTML that can be read with a reader such as InputStreamReader (as opposed to binary files). The Oxygene demonstration Reading Web Documents and its RemObjects C# equivalent output the downloaded HTML file content and some of its header data. Our simple demonstration with PasSFML in Lazarus outputs the content of the same file.

The Smart Pascal demonstration HTTP loads inet.txt from a web server and also shows the response to a request for a file that does not exist on the server.

Client-Server Applications

Our client-server programs in Oxygene for Java and RemObjects C# demonstrate the use of sockets. See the introduction, the Oxygene for Java server and client and the RemObjects C# equivalent server and client.

The Smart Pascal client-server echo programs make use of a file to store the latest data so that they will work with several commonly used browsers.

The above are simple echo servers. For a service that is helpful finding words in the dictionary that match letter patterns input into the client program see Client and Server Version of Crossword.

Networking demonstrates real-time updating of connected clients by the server. The Smart Pascal server uses Node.js, as does the Raspberry Pi server that returns the responses to the Pi's OS commands requested by a client. The Windows server also logs the commands requested by all clients. You can compare the Smart Pascal code of the servers with JavaScript versions. Most of the demonstrations in the Smart Mobile Studio section on datasets and databases have Smart Pascal servers and clients.

Max Foster's NetworkChat shows you how to use SDL in Lazarus for networking. NetworkChat works with a networked Raspberry Pi and PC. You could use Max's SuperMaximo SDL AppEngine to make it easier for you to write your networking program in Lazarus on the Pi.

James Hall's AlphaHost and AlphaClient, a networked version of his Koalas in Space game, also uses SDL in Lazarus.

We demonstrate a simple server and client using PasSFML in Lazarus.

See our tutorial page for our advice on how to start networking in C.

Accessing Databases on Websites

The Smart Pascal program Loading data from a MySQL database on the website uses these PHP scripts to retrieve the data from a MySQL database. A Smart Pascal Node.js server retrieves data from a Firebird database on a Raspberry Pi and sends it to be displayed in a memo on the Smart Pascal client that sent the SQL statement.

Embedding a Web Browser in an Application

You can easily adapt the following demonstration (designed to display your own HTML help files) to navigate to websites instead of accessing local files: Showing Help with the TWebBrowser Component in Delphi 7

An easier alternative in Windows is to call ShellExecute to open a browser with the required page. See Omar Hamid-Chohan's program Cars for sample code.

Accessing Map Data

The demonstration Displaying a Map accesses map data on the web. We supply full instructions for installing the necessary components into Lazarus.

Programming - a skill for life!

Overviews of site content and general information, tips and tricks for student programmers