For operations such as file transfer and secure shell, there are prebuilt tools such as ftp and ssh. We can also write custom scripts as network services. The next recipe demonstrates how to create simple network sockets and use them for communication.
Creating arbitrary sockets
Getting ready
The netcat or nc command will create network sockets to transfer data over a TCP/IP network. We need two sockets: one listens for connections and the other connects to the listener.
How to do it...
- Set up the listening socket using the following command:
nc -l 1234
This will create a listening socket on port 1234...