How to define UDP source port in WiFiEthernet ?

Hello

Does anybody know how to set the source port for udp messages ?

Udp.Begin(x) initializes a port on the receive side of the Arduino for incoming frames.

On the send side, i have not found a function to set the port yet.

So all messages start from 4097.

Best Regards,
Johi.

what is 'WiFiEthetnet'?

Hello Jurai,

Wifi Ethernet is Ethernet over wifi so Wifi.

My question remains:

Udp goes from port A / IP AA over the network to port B / IP BB

My problem is that port A (arduino side) cannot be set to my value, onlly the predefined 4097.

Andy idea's ?

code:

// init WiFi lib for WiFi shield:
status = WiFi.begin(ssid, key);

UDP.beginPacket(ipServer,UDP_PORT);
UDP.write(udpMsg,udpMsgLen);
UDP.endPacket();
udpMsgLen=0;
trig=0;

UDP_PORT is the target port, not the source port.

Best regards,
Johi.