Skip to content

AhmadAbukhuit/Network_Programming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Network Programming Projects in C

This repository contains six assignments developed for the NES 416 – Network Programming course at JUST (Jordan University of Science and Technology).
The assignments cover TCP/UDP socket programming, client-server models, I/O multiplexing, and multithreading in the C programming language.


🚀 Learning Objectives

  • Understand the fundamentals of network programming in C.
  • Build TCP and UDP client-server applications.
  • Implement iterative and concurrent servers.
  • Apply signal handling in UNIX/Linux.
  • Use I/O multiplexing for scalable client-server interaction.
  • Develop multi-threaded applications for parallel processing.
  • Practice file transfer, authentication, and string processing over sockets.

🛠️ Technologies Used

  • Language: C
  • Compiler: GCC (GNU Compiler Collection)
  • Libraries:
    • <stdio.h>, <stdlib.h>, <string.h>
    • <unistd.h>, <pthread.h>
    • <sys/socket.h>, <netinet/in.h>, <arpa/inet.h>
  • Environment: UNIX/Linux

TCP-client-server-socket-flow

📂 Assignments Overview

# Assignment Key Focus Description
1 Basic Client Interaction TCP Basics Simple client sends name to server → server replies with name + timestamp.
2 Iterative TCP Password Verification TCP, Iterative Server Client submits password → server validates against security rules. Connection open until done.
3 Concurrent TCP Server with Signals Concurrency, Signals Server forks a child per client, handles multiple requests, client exits on SIGQUIT.
4 UDP File Download Service UDP, File Transfer Client authenticates with server, requests file list, downloads files in chunks, adjusts buffer sizes.
5 TCP/UDP with I/O Multiplexing Hybrid, Multiplexing Client menu: (1) UDP download, (2) TCP upload, (3) Quit. Uses I/O multiplexing for efficiency.
6 Multithreaded TCP Character Counting TCP, Threads Multi-threaded client/server → counts occurrences of specific characters in strings.

📘 Assignment Details

Assignment 1 – Basic Client Interaction

  • Goal: Learn the building blocks of a network application.
  • Task: Client sends a name to the server, server replies with name + current time/date.
  • Command Example:
    hw1 <server_ip> <name>
    

Assignment 2 – TCP Password Verification

  • Goal: Implement TCP client-server with iterative design.
  • Client: Sends password to server until user types done.
  • Server: Validates password (length 8–16, includes 3 of: uppercase, lowercase, number, special).
  • Key Concepts: Iterative server, TCP communication.

Assignment 3 – Concurrent TCP Server with Signals

  • Goal: Understand concurrency + signals in client-server systems.
  • Server: Forks child per client, prints client IP/port, handles multiple requests.
  • Client: Exits on SIGQUIT, not by done.
  • Extra Rule: Special characters allowed @#$^&*+= (except %).

Assignment 4 – UDP File Download Service

  • Goal:
    Practice using UDP sockets to implement a simple file transfer system.
  • Process:
    1. Client authenticates with handshake bytes (0x55, 0xAA).
    2. Server responds with a list of available files.
    3. Client selects a file to download.
    4. File is transferred in 1024-byte chunks.
    5. Client can type done to exit the session.
    6. (Extra Feature): Client adjusts and displays send/receive buffer sizes for performance testing.

Assignment 5 – TCP/UDP with I/O Multiplexing

  • Goal: Investigate TCP + UDP with I/O multiplexing.
  • Client Menu:
    1. Download file via UDP.
    2. Upload file via TCP (to concurrent server).
    3. Quit.
  • Features:
    1. Hostname resolution via /etc/hosts.
    2. Upload/download over different protocols.
    3. Prevents flooding server (UDP call limited to once per 5 sec).

Assignment 6 – Multithreaded TCP Character Counting

  • Goal: Combine multithreading with TCP sockets.
  • Client:
    1. Input string + characters to count.
    2. Creates one thread per character to send request to server.
  • Server:
    1. Multi-threaded, counts occurrences, reports back per client thread.
    2. Tracks number of threads created so far.
  • Output Example:
    T2: # of r’s in the string = 1
    T3: # of A’s in the string = 3
    T4: # of 1’s in the string = 2
    Total occurrences = 6

About

This repository for my course NES416-Network Programming in JUST

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages