logo

关于openMV函数 socket返回异常:-1 的问题

2018-10-25 21:55
I
yqw6

我模仿示例代码做了一个TCP连接的py,该脚本实例化一个socket对象,然后调用该对象监听连接。运行时使用浏览器测试,结果经常被拒绝建立连接,在IDE的串口监视器中查看到输出:

5997787e-44ba-4067-af21-40ede2d08779.PNG

下面是我的部分代码:

while(True):

# Create server socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

try:

# Bind and listen

s.bind([HOST, PORT])

s.listen(5)

# Set server socket timeout

# NOTE: Due to a WINC FW bug, the server socket must be closed and reopened if

# the client disconnects. Use a timeout here to close and re-create the socket.

s.settimeout(None)

processHTTP(s)

except OSError as e:

s.close()

print("socket error: ", e)

#sys.print_exception(e)

我查找了星瞳科技提供的函数库,没有找到-1异常的原因,请告诉我这个异常的原因,或者我可以在哪里找到相关资料?