sockets - Reading incoming request string in python -
is there way can read incoming message client using 'socket' in python? looking way without using socketserver. doesn't work in case. example, have following piece of code 'accept' incoming connection? how can incoming string this?
import socket def serve(self): listener=socket.socket() listener.bind(('',6000)) listener.listen(5) while true: sockadd, c =listener.accept() # can write accepted request string??? # there way it?
i have tried listener.recv(1024)
gives exception.
help please, in advance.
sockadd
socket representing connection client here, use send , receive message client.
data = sockadd.recv(1024)
check socket documentation, there several samples.
Comments
Post a Comment