Message from Python discussions
November 2018
— I do not know if I understood correctly, but the interpreter is still complaining in the conn.recv print line ...
Import socket
def connect():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("192.168.25.32",8080))
s.listen(1)
print ("Listening at port 8080")
conn, addr = s.accept()
print ("We got a connection from: "), addr
while True:
command = raw_input(">shell ")
if "terminate" in command:
conn.send("terminate")
conn.close()
break
else:
conn.send(command)
print conn.recv(1024)
def main()
connect()
main()
— I don't know Python so well and those codes are not working on my computer or vps
— I don't know why because I checked my network port it is open
— But I can't connect it with my other devices
— 😂😂
— I'm doing a reverse connection server, I'm working for college, the client is already running, the problem is that server.py, that does not work, the syntax error
— This script opens port 8080 with this IP but it is from my internal network kkkk
— Just wanted to understand why he complains of this line:
print conn.recv (1024)
— '''def pat(str):
inc=0
dec=0
s=''
for i,c in enumerate(str):
if inc==2 or dec==2:
s=s[0:-1]+"-"+c
elif inc>2 or dec>2:
s=s[0:-1]+c
else:
s+=c
if i+1==len(str):
break
if ord(c)+1==ord(str[i+1]):
inc+=1
else:
inc=0
if ord(c)-1==ord(str[i+1]):
dec+=1
else:
dec=0
return s
i="12345"
print(pat(i))'''
— Why we take inc==2 here
— I'll check it, thanks.