OSerr = 23

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Posts: 2
Joined: Thu Jan 05, 2017 6:57 pm

OSerr = 23

Postby hannakt » Thu Jan 05, 2017 7:31 pm

I get an OSError:23 when I am in a loop listening for socket connctions.
The error occurs after 4 successful runs thought the loop and reports the dummy data back to the client.
ON the 5th try, the error pops up.

The code was stolen from a similar application running successfully on Raspberry Pi.
I.E. if there are subtle differences in how the socket calls should be handled, I didn't catch them.

What is OSError:23 ???

Any ideas?
Kevin Hanna

P.S. first time posting to any forum, so I'll get formatting done better next time.

I get this error:

File "/flash/sockets/st_02.py", line 41, in listen
OSError: 23

On this Executed code:
def listen():
HOST = '' # accept connections from anyone, else supply IP address of client.
PORT = 65000

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))

print (" Socket Server is : 'Listening' ")

while True:
#41 --> c, addr = s.accept() # Get socket object and client IP and port addresses ************ Line # 41 *******************
print ('Accepted connection from ',addr)
cmd = c.recv(1024)
if not cmd: break
cmd = 'get_temp' #fake it for now

print ( 'Command received = ' + str(cmd) )
print (cmd)
if cmd == 'get_temp':
print ('Decoded the get_temp cmd.')
temp_C = read_sensor()
print ("function returned temp is : " + temp_C)
print ("Sent to client : " +str(temp_C) + " Degrees C. ")


Posts: 2
Joined: Thu Jan 05, 2017 6:57 pm

Re: OSerr = 23

Postby hannakt » Mon Jan 09, 2017 5:37 am

Solved the issue..
sockets were not being closed.

At the very bottom of the code posted you will see:


Next problem is to learn how to post code blocks properly

Cheers and happy new year to all,

User avatar
Posts: 2097
Joined: Mon Jan 06, 2014 6:08 pm
Location: Shuswap, BC, Canada

Re: OSerr = 23

Postby dhylands » Tue Jan 10, 2017 12:46 am

I think you've posted the code blocks properly. However, the first few posts from a new member are moderated. Then system also suppresses formatting (like code blocks), so once moderation is removed if you go back and view those posts then they'll magically appear to be fine.

Return to “General Discussion and Questions”

Who is online

Users browsing this forum: No registered users and 3 guests