I use the code I found here to create a socket to send/receive from a server I have running on another computer on my local network.
Code: Select all
s = socket.socket() time.sleep(0.1) s.connect((host, port))
I saw this socket.error statement in the docs: ( http://docs.micropython.org/en/latest/w ... ocket.html)
Exceptions --- socket.error --- socket.timeout
But I don't know how to use these in my code. Can anyone provide an example for me? I saw examples of a 'try:' and 'except socket.error, (value,message):' command, but couldn't seem to get that to work, got syntax errors at the 'except' line, and was wondering if maybe this is not yet fully implemented in MicroPython (ESP8266), or most likely a coding error on my part? I'm new to this, so examples really help.
Or some alternate to just ignore this and allow the code to return from the function?