Communicating with a remote device
Since the scope of this book is not to provide details on networking programming, we're not going to spend too much time in showing the several available communication protocols or in explaining the details of the following example codes. However, we're going to show you how you can use an Ethernet port to quickly establish a networking communication.
A simple TCP client/server application
Just as a simple example of network communication, we can use two simple Python programs that implement a TCP/IP client and server examples. These examples are not so useful to show you how you can write a server or a client (there are tons of these examples on the Internet). However, they are useful to show you how you can easily interact with several ready-to-use tools (presented in the next section) that can speed up the development stage of every networking task.
The first program is named tcp_srv.py
, and it implements a TCP/IP server. Here is its relevant...