# Failure accepting socket on WR44v2 (python)

**URL:** <https://forums.digi.com/t/failure-accepting-socket-on-wr44v2-python/17676>\
**Category:** Python\
**Tags:** tcp-sockets, wr44v2, python\
**Created:** [November 29, 2016, 4:03pm UTC](https://forums.digi.com/t/failure-accepting-socket-on-wr44v2-python/17676 "2016-11-29T16:03:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![brownlieig](https://avatars.discourse-cdn.com/v4/letter/b/e47774/32.png) [@brownlieig](https://forums.digi.com/u/brownlieig)\
**Post date:** [November 29, 2016, 4:03pm UTC](https://forums.digi.com/t/failure-accepting-socket-on-wr44v2-python/17676/1 "2016-11-29T16:03:04Z")

</div>

I am writing an application using a third party python library “Modbus\_tk”. I had this running before on a similar Digi device but I am currently getting “Error 12” returned from the socket.accept() method. Can someone please explain what this error message represents. The code below is slightly simplified for readability.

The socket is created with no errors

sock = socket.socket(socket.AF\_INET, socket.SOCK\_STREAM)  
sock.settimeout(timeout\_in\_sec)  
sock.setblocking(0)  
sock.bind((“”,port))  
sock.listen(5)  
sockets.append(sock)

The main loop checks for incoming connections

inputready, outputready, exceptready = select.select(sockets, [], [], 1.0)  
for s in inputready: #handle data on each a socket  
try:  
if s == sock:  
# handle the server socket  
LOGGER.debug(“Handle the server socket”)  
LOGGER.debug(“… accept”)  
client, address = sock.accept()  
… more

except Exception, excpt:  
LOGGER.warning(“Error while processing data on socket %d: %s”, s.fileno(), excpt)

Error log indicates failure on the accept statement

2016-11-09 14:46:43,609 DEBUG modbus\_tcp.\_do\_run Thread-1 Handle the server socket  
2016-11-09 14:46:43,619 DEBUG modbus\_tcp.\_do\_run Thread-1 … accept  
2016-11-09 14:46:43,619 WARNING modbus\_tcp.\_do\_run Thread-1 Error while processing data on socket 5: [Errno 12] ERROR
