我的運行環(huán)境是python2.7的運行一段代碼失敗,初學(xué)者,在網(wǎng)上也找不到正確的回答,請幫忙import socket
host= ''
port= 51423
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.setsockopt((socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
s.bind((host,port))
print "waiting for connections......."
s.listen(1)錯誤提示: File "g:\python\socket\1.py", line 8 s.bind((host,port)) ^SyntaxError: invalid syntax
- 1 回答
- 0 關(guān)注
- 682 瀏覽