GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - nihahawas/Socket-Programming-Python: A Python-based Socket Programming project implementing both TCP and UDP communication using client-server architecture. This project demonstrates reliable and connectionless data transmission, message exchange, and basic networking concepts using Python sockets in Jupyter Notebook or VS.

BranchesTags
Open more actions menu

Latest commit

 

History

7 Commits
7 Commits

Folders and files

NameName
Last commit message
Last commit date
LICENSE
LICENSE
 
 
README.md
README.md
 
 
tcp-server-client.png
tcp-server-client.png
 
 
tcp_client.py
tcp_client.py
 
 
tcp_server.py
tcp_server.py
 
 
udp_client.py
udp_client.py
 
 
udp_server.py
udp_server.py
 
 

Repository files navigation

šŸ”Œ TCP & UDP Socket Programming using Python

Python Socket Status License

A complete implementation of Client-Server Communication using Python's built-in socket library — covering both TCP and UDP protocols with real-time bidirectional messaging.


TCP Server and Client communication

tcp-server-client

šŸ“Œ About This Project

This project demonstrates real-time Client-Server Communication using Python sockets. It implements both TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) with features like timestamps, uppercase conversion, message counting, and graceful exit handling.


šŸ“ File Structure

Socket-Programming-Python/
│
ā”œā”€ā”€ tcp_server.py       # TCP Server Program
ā”œā”€ā”€ tcp_client.py       # TCP Client Program
ā”œā”€ā”€ udp_server.py       # UDP Server Program
ā”œā”€ā”€ udp_client.py       # UDP Client Program
└── README.md           # Project Documentation

✨ Features

  • āœ… TCP Client-Server Communication
  • āœ… UDP Client-Server Communication
  • āœ… Student Name & Registration Number on startup
  • āœ… Timestamp on every message [HH:MM:SS]
  • āœ… Messages automatically converted to UPPERCASE
  • āœ… Message counter (tracks total messages sent)
  • āœ… Type exit to gracefully end the session

šŸ”„ TCP vs UDP

Feature TCP UDP
Connection Required Not Required
Reliability High āœ… Low āš ļø
Speed Slower Faster ⚔
Data Order Guaranteed Not Guaranteed
Port Used 12345 12346
Real-world Use HTTP, FTP, Email Streaming, Gaming, DNS

šŸš€ How to Run

Prerequisites

python --version   # Make sure Python 3.x is installed

ā–¶ļø TCP Communication

Open two terminals simultaneously:

# Terminal 1 — Run Server FIRST
python tcp_server.py

# Terminal 2 — Run Client SECOND
python tcp_client.py

ā–¶ļø UDP Communication

# Terminal 1 — Run Server FIRST
python udp_server.py

# Terminal 2 — Run Client SECOND
python udp_client.py

āš ļø Always start the Server before the Client!


šŸ’¬ Sample Output

========================================
        UDP SERVER STARTED
  Student : Niha Hawas
========================================
Listening on 127.0.0.1:12346 ...
Waiting for messages...

[20:24:28] Client [1]: HELLO
  ā”” UPPERCASE: [NIHA HAWAS | 2312274] CLIENT: HELLO
Your Reply: HI

[20:24:46] Client [2]: HAVE YOU DONE YOUR TASK
  ā”” UPPERCASE: CLIENT: HAVE YOU DONE YOUR TASK
Your Reply: YES IT IS DONE

āœ… UDP Server closed. Total messages handled: 7

šŸ“‹ Tasks Completed

# Task Status
1 TCP Server and Client communication āœ…
2 UDP Server and Client communication āœ…
3 Exchange at least 5 messages āœ… (7 messages)
4 Send Student Name and Registration Number āœ…
⭐ Timestamps on every message āœ…
⭐ Convert messages to UPPERCASE āœ…
⭐ Terminate session with exit command āœ…

šŸ› ļø Technologies Used

Tool Purpose
Python 3.x Core Language
socket module Network Communication
VS Code Development Environment
GitHub Version Control

šŸ“š Concepts Covered

  • Client-Server Architecture
  • TCP — Connection-Oriented Communication
  • UDP — Connectionless Communication
  • Socket Binding, Listening & Accepting
  • Real-time Bidirectional Messaging
  • Data Encoding & Decoding over Sockets

šŸ‘©ā€šŸ’» Author

Niha Hawas
 

šŸ“„ License

This project is licensed under the MIT License — feel free to use and modify.


Made with ā¤ļø by Niha Hawas

About

A Python-based Socket Programming project implementing both TCP and UDP communication using client-server architecture. This project demonstrates reliable and connectionless data transmission, message exchange, and basic networking concepts using Python sockets in Jupyter Notebook or VS.

Topics

client-servercomputer-networksjupyter-notebooklab-projectnetwork-programmingnetworkingpythonpython-projectpython-socketssocket-programmingtcptcp-clienttcp-iptcp-serverudpudp-clientudp-servervscode

Resources

Readme
MIT license
Activity

Stars

2 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Ɨ600. No cookies required.