Hello guys. I made this code to send commands to another machine. But every time i wanna send a command it creates a new socket to do that. Whats the best way to use the same socket to communicate?
PHP Code:
<?php
if ($_POST){
$sock = socket_create(AF_INET, SOCK_STREAM, 0);
socket_connect($sock, "127.0.0.1", 6000);
socket_send($sock, $_POST["command"], strlen($_POST["command"]), 0);
}
?>
<form action="message.php" method="post">
<input type="text" name="command"/><input type="submit"/>
</form>