I cannot make PHP release the port after it binds
to it, the following script should just open a
port, accept one line of input, write the contents
to the out file, then unbind and close the connection.

It works fine, with the exception of if I run it
again, it reads the port as still being bound. Any
ideas on how to fix my script, or atleast free the
port without having to reboot?


<?php
        define('IP','127.0.0.1');
        define('PORT','23');
 
        $s = socket_create(AF_INET,SOCK_STREAM,0);
        socket_bind($s,IP,PORT);
        socket_listen($s);

        $f = fopen('out','w');

        $a = socket_accept($s);
        fwrite($f,socket_read($a,1000));

        fclose($f);

        socket_shutdown($a);
        socket_close($a);

        socket_shutdown($s);
        socket_close($s);
?>


-- 
Adam Voigt ([EMAIL PROTECTED])
Linux/Unix Network Administrator
The Cryptocomm Group


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to