Tag Archives: c sockets

Programming UDP sockets in C on Linux – Client and Server example

By | July 31, 2020

UDP sockets This article describes how to write a simple echo server and client using udp sockets in C on Linux/Unix platform. UDP sockets or Datagram sockets are different from the TCP sockets in a number of ways. The most important difference is that UDP sockets are not connection oriented. More technically speaking, a UDP… Read More »

How to Get Domain Whois Data in C with Sockets on Linux – Code Example

By | August 7, 2020

Whois A whois client is a program that will simply fetch the whois information for a domain/ip address from the whois servers. The code over here works according to the algorithm discussed here. A whois server runs a whois service on port 43 (whois port). We need to connect to this port with sockets and… Read More »

Get ip address from hostname in C with Linux sockets

By | July 31, 2020

Socket applications often need to convert hostnames like google.com to their corresponding ip address. This is done through dns requests. The socket api in linux provides functions like gethostbyname and getaddrinfo that can be used to perform the dns requests and get the ip address. 1. gethostbyname The first method uses the traditional gethostbyname function… Read More »

How to code a SYN Flood DOS attack program in C on Linux

By | July 31, 2020

TCP/IP 3-way handshake is done to establish a connection between a client and a server. The process is : 1. Client –SYN Packet–> Server 2. Server –SYN/ACK Packet –> Client 3. Client –ACK Packet –> Server The above 3 steps are followed to establish a connection between source and destination. SYN Flood DOS attacks involves… Read More »