<form action="UDPsrvr.php" method="post"> Name :<input type="text" name="data"><br> <input type="submit" value="Send" name="subt"/> </form> <?php error_reporting(E_ALL | E_STRICT); $socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); socket_bind($socket, '127.0.0.1', 1223); $from = ''; $port = 0; socket_recvfrom($socket, $buf, 12, 0, $from, $port); //echo "Received $buf from remote address $from and remote port $port" . PHP_EOL; echo "<textarea name='n'>".$buf."</textarea>"; if($_POST['subt']){ $data= $_POST['data']; socket_sendto($sock, $data, $len, 0, '127.0.0.1', 1223); } ?>
<form action="UDPclint.php" method="post"> Msg :) <input type="text" name="nm"><br> <input type="submit" value="Send" name="sub"/> </form> <?php if(isset($_POST['sub'])) { $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); $msg = $_POST['nm']; $len = strlen($msg); socket_sendto($sock, $msg, $len, 0, '127.0.0.1', 1223); socket_close($sock); } ?>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)