2 years, 10 months ago.

Multiple sockets one EthernetInterface?

I have an application that acts as a UDP server on one socket. I also want to have a second reliable channel (TCP socket) for commands and bootloader. If I declared two sockets as such

socket declarations

TCPServer serv; // or TCPSocket..
UDPSocket socket;

Bound to the same..

ethernet interface

EthernetInterface net;

Then I crash.

However if i bind to separate...

ethernet interfaces

EthernetInterface net;
EthernetInterface tcp_eth;

Then the code will run and work... very inconsistently and nondeterministically.

My intuition would be that there would be a singular "EthernetInterface" object and multiple child sockets for such a topology.

Anybody have experience here?

Be the first to answer this question.