Skip to content

Instantly share code, notes, and snippets.

View osalbahr's full-sized avatar

Osama Albahrani osalbahr

View GitHub Profile
@osalbahr
osalbahr / tcpServer1.py
Last active October 5, 2025 11:50 — forked from mike-zhang/tcpServer1.py
a simple tcp server (python3 code)
#!/usr/bin/env python3
# a simple tcp server
import socket,os
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('127.0.0.1', 12345))
sock.listen(5)
while True:
connection,address = sock.accept()
buf = connection.recv(1024)
print(buf)