Raw Socket Example with Connect and Bind API – setup

For the current example, we will try and create two virtual interfaces for the client and server end of the TCP connection. To create the Virtual interfaces, check the output of the “ifconfig” command on the terminal and create the virtual interfaces based on the base network interface of your system.

In my system, the below output is shown running the ifconfig terminal command

by running the below shown commands, two virtual interfaces are created.

sudo ifconfig enp0s3:1 192.168.1.11 up 

sudo ifconfig enp0s3:2 192.168.1.14 up

Now the IP interfaces that we need are setup, let us try and send TCP data between the two IP addresses. 

Raw Socket Example with Connect and Bind API