I'm no expert by any means but Ive been trying this too.
Whenever I tried to bind with the host being anything but "0.0.0.0" it just would not work.
And I think it's good practice to use a higher port number like 41152.
Here is what I've been using :
[code]
port = 41152
host = '0.0.0.0'
def serverInit():
global port
global host
try:
s = socket.socket()
print("socket created")
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
print("options set")
s.bind((host, port))
print("bound")
s.listen(1)
print("listening")
c, a = s.accept()
#print(c)
#print(a)
if c:
print("Client connected")
return c
except OSError as er:
print(er)
[/code]
I also noticed if I have the REPL open and do a ctrl D to reboot the board I get a [Errno 12] ENOMEM message.
If the REPL is not active it works as expected.
Hope this helps
Tim
Sorry I haven't posted enough for code blocks to work
