title: Is there a way to specify the source UDP port using PHP?
body: <p>I need to send a message via UDP to a remote equipment. I know that if I use the same UDP port that it used while sending information to the server to write back to it the messages goes through.</p>
  
  <p>I am currently using:</p>
  
  <pre>
          $fp = fsockopen( $destination, $port, $errno, $errstr);
          if (!$fp) {
             echo "ERROR: $errno - $errstr\n";
          } else {
             fwrite($fp, $m);
             fclose($fp);
          }
  </pre>
  
  <p>But in this way I have no control of which port is going to be used as the source port.</p>
  
  <p>In Java have one can use:</p>
  
  <pre>
         client = new DatagramSocket(21000);
  </pre>
  
  <p>Is there a way to do something similar using PHP.</p>