I am writing PIC microcontroller code to interface with the W5500. According to the information at http://wizwiki.net/wiki/doku.php?id=products:w5500:application:udp_function, bytes 4-5 of packet info in a received packet header should correspond to the destination port of the packet. This, however, doesn’t seem to be the case, with the bytes being seemingly random (for example, with a port of 8888, the “port” seems to be somewhere in the 40000’s). I’ve tried reading it as both big and little endian (taking byte 4 as the high byte or taking it as the low byte), but it still doesn’t work out to the right port. Changing the port does seem to change this value, but it never seems to be right.
This isn’t a huge deal as, apart from this, everything else works perfectly. Everything else in the header is correct and I can send and receive packets with no issue; I’m just curious as to what this value I’m reading actually is. I can include relevant code if need be, but considering everything else that I read/write is fine, I don’t think it is a code issue.
Any clarification that anyone can give regarding this would be much appreciated.