Providing remote server connectivity for clients
Our console app isn't really a true server yet because it has a user interface (albeit a crude one) that accepts input and displays output and then exits—no client app interacts with it. Our next step, then, is to replace the Readln
and Writeln
statements in the body of the main program loop, which waits for a human to type something into the console, with a way to start a listening and response mechanism that can be used by a client app.
Copy the data module (both the .pas
and .dfm
files) into a new folder and create a new app with it added; call this new app MyParksTCPServerConsole
.
There are many ways for server and client applications to talk to one another. We discussed how Bluetooth was used in the previous chapter, which works when two devices are close together. In this chapter, we will use a very common method of communication used across the internet, which works anywhere a network connection is available...