Setting UDP


A destination IP address and port number can be specified before sending UDP data. If so, these parameters can be omitted in fourth and fifth argument of pid_sendto function. Set command of pid_ioctl function is required to set UDP.

pid_ioctl($pid, "set ITEM VALUE");

ITEM means setting items and VALUE is possible value of the item.

Available UDP Items

ITEM VALUE Description
dstaddr e.g. 10.1.0.2 destination IP address
dstport e.g. 1470 destination port number

example of setting UDP

<?php
$pid = pid_open("/mmap/udp0");            // open UDP 0
pid_bind($pid, "", 1470);                 // binding
pid_ioctl($pid, "set dstaddr 10.1.0.2");  // destination IP address
pid_ioctl($pid, "set dstport 1470");      // destination port number

?>