1

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?

N R Niloy
  • 13
  • 2
  • Follow this link: [python bind socket.error: Errno 13- Permission denied](https://stackoverflow.com/questions/24001147/python-bind-socket-error-errno-13-permission-denied) – Alireza HI May 01 '20 at 22:38
  • Or you may follow this link: https://stackoverflow.com/questions/40996724/errno-13-permission-denied-on-mac – Elbo Shindi Pangestu May 01 '20 at 22:41

0 Answers0