OSerr = 23
Posted: 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?
Regards,
Kevin Hanna
P.S. first time posting to any forum, so I'll get formatting done better next time.
KTH
****************************************************************************
I get this error:
File "/flash/sockets/st_02.py", line 41, in listen
OSError: 23
>>>
On this Executed code:
[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))
s.listen(7)
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)
c.send(str(temp_C))
print ("Sent to client : " +str(temp_C) + " Degrees C. ")
c.close
[/CODE]
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?
Regards,
Kevin Hanna
P.S. first time posting to any forum, so I'll get formatting done better next time.
KTH
****************************************************************************
I get this error:
File "/flash/sockets/st_02.py", line 41, in listen
OSError: 23
>>>
On this Executed code:
[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))
s.listen(7)
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)
c.send(str(temp_C))
print ("Sent to client : " +str(temp_C) + " Degrees C. ")
c.close
[/CODE]