chatclient
chatclient.py — text/python-source, 1 KB
Dateiinhalt
# -*- coding: utf-8 -*-
import socket
from threading import Thread
PORT = 8500
EPORT = 8501
host = 'localhost'
service= socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
service.bind(("", EPORT))
clients=[]
print "Starte Client auf Port", EPORT
class emp (Thread):
def __init__(self):
Thread.__init__(self)
Thread.start(self)
def run(self):
while True:
data, client = service.recvfrom(100)
print str(data)
e = emp()
while True:
text = raw_input(">")
service.sendto(text, (host,PORT))