Examples for Linux programming interface (system calls, library functions, etc ...)
Open a file using different flags and modes.
Basic example of cp
Linux command.
Kernel buffer mechanism and impact of syscalls.
Calendar time, break down functions and print examples.
Measure process time (system and user time) for a component using process time implementation.
Process segments (text, initialized data and uninitialized data)
Explain heap memory usage, how program break increase and decrease.
signal() system call to change disposition for a particular signal and ignore a signal.
TCP Client/Server application example using unix domain sockets.
UDP Client/Server application example using unix domain sockets.
UDP Client/Server application example using unix domain sockets created by socketpair() and fork() system calls.
# Create virtual ethernet interfaces
sudo ip link add veth0 type veth peer name veth1
sudo ip addr add 192.168.1.1/24 dev veth0
sudo ip addr add 192.168.1.2/24 dev veth1
sudo ip link set veth0 up
sudo ip link set veth1 up
# Remove virtual ethernet interfaces
sudo ip link del veth0
UDP Client/Server application example using internet domain sockets.
DNS showing resolving a host using getaddrinfo().
UDP Server application that also extract the hostname and service of the client.
Generic implementation for bind, connect and listen using getaddrinfo() that is able to perform name and port resolution, removing the constraint of always knowing server ip address or port.
Generic implementation for a tcp client that read data from standard input and send them to server after establishing the connection.
Iterative tcp server is implemented using the generic functions using IPv4 and stream sockets for communication. It will only continue with the next client after the connection with current client is closed.
The it_tcp_server can be tested using /run/tcp_client.
./run/tcp_client
The it_tcp_server can also be tested using telnet command.
telnet localhost 50001
Iterative udp client-server is implemented using the generic functions using IPv4 and datagram sockets for communication.
Concurent tcp server is implemented using the generic functions using IPv4 and stream sockets for communication. A new process is created for each connection reaching to the server, dealing with clients in parallel.
The proc_con_tcp_server can be tested using /run/tcp_client.
./run/tcp_client
The proc_con_tcp_server can also be tested using telnet command.
telnet localhost 50001
Concurent tcp server is implemented using the generic functions using IPv4 and stream sockets for communication. A new thread is created for each connection reaching to the server, dealing with clients in parallel.
The proc_con_tcp_server can be tested using /run/tcp_client.
./run/tcp_client
The proc_con_tcp_server can also be tested using telnet command.
telnet localhost 50001
Concurent tcp server is implemented using the generic functions using IPv4 and stream sockets for communication. To speed up the process, a thread pool is used to reduce the overhead of creating and joining a new thread on each new connection.
The thread_pool_con_tcp_server can be tested using /run/tcp_client.
./run/tcp_client
The thread_pool_con_tcp_server can also be tested using telnet command.
telnet localhost 50001