Skip to content

Instantly share code, notes, and snippets.

@MFaik
MFaik / chat_app.py
Created December 5, 2024 12:56
A simple chat app that explodes if anything goes wrong. Also you need to take turns sending messages :/
import socket
def server_code():
name = input("Enter your name: ")
port = int(input("Enter a port: "))
print(f"Your ip is: {socket.gethostbyname(socket.gethostname())}")
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('', port))