#!/usr/bin/env python # -*- coding: utf-8 -*- # Author: Janice Cheng import socket ip_port = ('127.0.0.1',8080,) s=socket.socket() s.bind(ip_port) s.listen(5) while True: conn, addr = s.accept() conn.sendall(bytes('hello',encoding='utf-8')) while True: recv_bytes = conn.recv(1024) if str(recv_bytes,encoding='utf-8') == 'q': break conn.sendall(recv_bytes) s.close()