WIZnet Developer Forum

UDP more same sockets

Hello,
please I would like to learn socket interrupt and receiving function (W5500).
I need to semlessly receive data thru UDP.
I have open all 8 sockets as UDP, all with same source port.

If one UDP packet is received, after it, interrupt is asserted.
I found that another packed can be received if there is enough place in RX buffer.
But, if there is some delay between incoming packets, just one packet is received and the other no.
Why another open sockets (open and with issued RECV command) do not receive next incoming packets?
Is it not possible to have open more then one UDP socket?
I need to receive packets even in time when I read RX buffer. Is it possible?

Thanks a lot.

Jan

Hello, harman

Do you want to use 8 sockets as UDP and connect to same UDP server?

Could you capture the packet you received from Server?

It is hard to see what your problem here…

Thank you

Lawrence

Hi,
the problem is in the protocol structure.
Your device is in the network with the same MAC address and IP address for all sockets that have opened.
UDP communication takes place without connection then opening more sockets in RX on the same port the sender continues the trasmission using a random socket and In this context it will be difficult to reconstruct the flow in the right way because the bytes may have a different order than transmitted because there is no flow control (bytes order) of the stream.
Then from what I understand you are using interrupts then the first occurrence causes reading the bytes arriving on one random socket.
I think the correct approach in the case of UDP streams would instead open a single socket and wait for reading to a minimum of received bytes before start an asynchronou read (like a FIFO for instance).
In this way you would have time to read the incoming bytes and go on to even larger flows of the maximum size of the receive buffer.

Copyright © 2017 WIZnet Co., Ltd. All Rights Reserved.