Category ‘Networking’
- TECHPULP |
Why my route command is slow in Linux
Basically default usage of route command makes route command to resolve all IP addresses to display symbolic host names. If your connection to DNS server is slow or not working, route command spends some time in waiting for response from... - TECHPULP |
How to validate IP address in C
Any valid IP address consists of four numbers separated by three period (.) characters and each nunber ranges from 0-255 inclusive. An example IP address is “125.231.167.234″. The string function sscanf can be used to extract the four numbers and... - TECHPULP |
How to scan all reserved ports on a host using nmap
nmap is a very useful network exploration tool and security scanner. It can be used to scan all open ports on a host. The following example shows how it can be used. However port scanning is just one of the... - TECHPULP |
How to use Secure Shell (SSH)
Secure shell (SSH) is a replacement for telnet. telnet uses plain text protocol so a man in the middle can see what is being exchanged between client and server including sensitive information like passwords. A more sophisticated hacker can even... - TECHPULP |
How to resolve “Address already in use” error with bind system call
To get rid of “Address already in use” error with bind system call, SO_REUSEADDR socket option should be set before invoking bind. This makes operating system to allow the socket to bind if there is no active socket bound to... - TECHPULP |
Find local IP address and local port number using getsockname
The getsockname function can be used to find the local port used by a given socket. It is valid to use this function only if the socket is already using a local port number. i.e A server socket which invoked... - TECHPULP |
Find peer IP address and port number using getpeername
The getpeername function can be used to retrieve the peer IP address and port number on a given socket. For this to work, the socket should have a valid TCP connection established. Typically this is used by server to find... - TECHPULP |
Identify processes that have open sockets
The lsof can be used to find the list of processes that have active sockets open. Let us see the list of current TCP connections using netstat command. [liz@techpulp ~]# netstat -nt Active Internet connections (w/o servers) Proto Recv-Q Send-Q...