WiFi Shield - bind UDP packet source port

Dear all,

Can I assign the source port of Arduino for my UDP packet? (Like bind() in Linux) Or know which source port is used for sending out the packet?

Thank you.

(I have a smiliar post before, maybe I asked not so clearly, hence I open a new post to ask again)

When you start the udp service, you specify which port it will use. This sends and receives using port 8888. http://arduino.cc/en/Reference/WiFiUDPBegin

WiFiUDP Udp;
unsigned int localPort = 8888;      // local port to listen on

// then in setup after starting the wifi
if(!Udp.begin(localPort)) Serial.println(F("no socket error"));

edit: The documentation is not totally correct. The WiFiUDP.begin(port) function does return a value. It returns 0 if fail (no socket available), or 1 if success.