I am new to python as well as programming and learning networking. I wrote this on eclipse:
import socket
host="localhost"
port=400
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.bind((host,port))
s.listen(1)
print("server listen on port",port)
c,addr=s.accept()
print("Connection from", str(addr))
c.send(b"hello how are you?")
c.send("bye".encode())
c.close()
It shows this:
s.bind((host,port))
PermissionError: [Errno 13] Permission denied
I'm on a mac os. How to solve this?