Networking in C
- Compile the simple stream server (Section 6.1 of the guide) in a project named server.
- Compile the simple stream client (Section 6.2 of the guide) in a project named client.
- Open two LXTerminals and change directory if necessary to the working directory of Code::Blocks.
- Execute the server and then the client using the commands shown in this screenshot.
Server and client in action
- You should be tempted to change the server so that it sends some useful information and to try other code in the guide.
- The guide (with many different language versions linked to on this page) is very informative so use it to study the theory.
As stated in the guide, you can test the server with telnet. Install it with the command sudo apt-get install telnet then access the simple stream server with the command telnet localhost 3490.
Remote access from a PC
You can use the telnet option within PuTTY on a PC to obtain the response from the server on a Pi on the same network. The screenshots show the configuration of PuTTY and the response.
Configuration of PuTTY for accessing the simple server
Response from the simple server