pid_bind()


int pid_bind ( int $pid [, string $addr = "", int $port = 0 ] )

Description

pid_bind() binds a name. This bind function is necessary before using UDP reception.

※ available F/W version : all

Parameters

Return values

Returns 0 on success, PHP error on error.

Example

<?php
$buf = "Hello PHPoC!";
$peer_addr = "10.3.0.10";
$peer_port = 1470;

$pid = pid_open("/mmap/udp0");
pid_bind($pid, "", 1470);

$wlen = pid_sendto($pid, $buf, strlen($buf), 0, $peer_addr, $peer_port);
echo "udp sent ($wlen bytes)\r\n";
?>

See also

pid_open() / pid_ioctl() / pid_sendto() / pid_recvfrom()

Remarks

None