oh sorry.. i am new to the forum.. ll use code tag :)
Syntax error in python 2.3.4
Collapse
X
-
-
i tried using indentation.. but the error comes in the print line following the client accept code. i.e 2nd line from try. :(Comment
-
-
-
I suspect it is still an indentation problem. Your indentation should look like this:Note that the number of spaces representing an indentation is a matter of preference but should be consistent. I prefer 4 spaces. Also note it is bad practice to mix spaces and tabs.Code:from socket import * s = socket(AF_INET,SOCK_STREAM) h=gethostbyname(gethostname()) print 'host is ',h s.bind((h,9000)) s.listen(1) while 1: try: client, address = s.accept() print 'connection from', address data = client.recv(1024) if not data: break client.send(data) client.close() except IOError: print'IOError is there !' client.close()Comment
-
Comment