Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

Lab 0: Environment Setup & Common Header Block

Lesson 1 of 11 in the free Network Programming Lab notes on Siksha Sarovar, written by Rohit Jangra.

Run Everything Right Here

Every experiment in this lab has a runnable version in the built-in compiler — click RUN CODE on any practical. Client–server pairs are combined into one program with fork(): the child process plays the server, the parent plays the client, talking over loopback (127.0.0.1) exactly as they would across two terminals.

Compiler Info

PropertyValue
CompilerGCC (latest)
StandardC11
BackendWandbox Cloud (Linux sandbox)
SocketsBSD sockets API + fork() + loopback supported

Lab Setup (for your own machine)

For the real lab record, use any Linux box or WSL (Windows Subsystem for Linux) on Windows:

sudo apt install build-essential

Compile with gcc prog.c -o prog; for client–server experiments run the server and client in two separate terminals.

Common Header Block

Every program in this lab starts with the same include set — write it once at the top of your record:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>

How This Lab Maps to the Theory Course

ExperimentTheory unit it demonstrates
1 — Sockets for send/receiveUnit 1 Elementary TCP Sockets + Unit 2 Elementary UDP Sockets
2 & 3 — Local & remote socket addressUnit 1 Socket Address Structures (value-result arguments)
4 — Host / network / protocol / domain infoUnit 3 Name & Address Conversions
5 — IP address manipulationUnit 1 Byte Ordering + Unit 3 Broadcasting
6 — Telnet clientUnit 2 I/O Multiplexing (select) + Unit 4 Remote Login
7 — FTP clientUnit 1 Multiple connections per application
8 — Web serverUnit 1 Concurrent Servers
9 — File access via socketsUnit 2 shutdown vs close (half-close)
10 — Advanced socket callsUnit 2 Socket Options & Advanced I/O
Tip: after each experiment, note in your record WHICH theory section it demonstrates — examiners reward the connection, and the viva questions are drawn from exactly those sections.