adafruit / Adafruit_CircuitPython_Wiznet5k

Pure-Python interface for WIZNET 5k Ethernet modules
Other
15 stars 37 forks source link

socket.py accept() is stuck in a loop because the status that would exit the loop never updates #91

Closed schaefer01 closed 1 year ago

schaefer01 commented 1 year ago

I'm trying to set the rp feather as a server so I can send a command into it. socket.py the socket.accept() call loops forever on self.status if initial value of self.status is not a handled value because there is no call to a function that updates the status value.

Here's my diagnostic, the initial value of self.status as returned in my test is likely random, for me, the value returned was 0x20, or CMD_SOCK_SEND.

My question is, what function updates self.status?

   while self.status not in (
        wiznet5k.SNSR_SOCK_SYNRECV,
        wiznet5k.SNSR_SOCK_ESTABLISHED,
    ):
        if self._timeout > 0 and time.monotonic() - stamp > self._timeout:
            return None
        if self.status == wiznet5k.SNSR_SOCK_CLOSED:
            self.close()
            self.listen()
        if (debug_f):
          ii = ii + 1
          if (ii < 10):
            print("self.status",self.status)
        # endif debug
schaefer01 commented 1 year ago

I think what is needed, is a call to socket_status()

schaefer01 commented 1 year ago

are self.status and self.status() the same thing?

schaefer01 commented 1 year ago

I'm seeing 20, which is 0x14, which is "listening" should the while loop be exited at this point?

schaefer01 commented 1 year ago

I'd like to close this, I don't know what I'm doing.