Network Socket Programming using TCP in C

1.0 Client-server model

Client - Server System

Client server model is a software architecture paradigm prevalent in distributed applications. A server has information resources and processes that provide answers to queries and other services to remote clients over the network. Some of the examples of these services are booking an airline ticket and/or a room in a hotel, sending a file to a client, sending a mail message to another person (client), etc.… Read more

ss command in Linux

1. ss command

The ss command gives the socket statistics. It gives information about the network connections. ss is a replacement for the netstat command.

By default, the ss command gives information about non-listening sockets.

$ ss
Netid  State      Recv-Q Send-Q   Local Address:Port       Peer Address:Port
u_str  ESTAB      0      0                    * 4482                  * 4481
u_str  ESTAB      0      0                    * 4285                  * 3631
...
Read more

netstat

1. netstat command

The netstat command in Linux provides network statistics and information about the networking subsystem. It gives information about network connections, routing tables and network interface statistics. For example,

$ netstat
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 myhost.local:53744      mail.example.i:imaps    ESTABLISHED
tcp        0      0 myhost.local:36149      example.com:http        ESTABLISHED
tcp        0      0 myhost.local:57051      imap.example.n:imap2    ESTABLISHED
tcp        0      0 myhost.local:51209      mail.example.i:imaps    ESTABLISHED
tcp        0      0 myhost.local:35617      example.com:http        ESTABLISHED
tcp        0      0 myhost.local:51207      mail.example.i:imaps    ESTABLISHED
tcp        0      0 myhost.local:52281      r-198-51-100-12.tw:http ESTABLISHED
tcp        0      0 myhost.local:51208      mail.example.i:imaps    ESTABLISHED
tcp        0      0 myhost.local:52282      r-198-51-100-12.tw:http TIME_WAIT
...
Read more