Hello. I thought Sockets Under win didn't work.. maybe you can try with this other script: http://marc.theaimsgroup.com/?l=php-general&m=98225134721753&w=2
----- Original Message ----- From: "Walter Gyr" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, November 18, 2001 8:59 AM Subject: [PHP-WIN] Use sockets under windows > Hi > > I'm looking for a sample about sockets for windows NT. > I want test the sample from manual bad doesnt work with Windows. > I know that the window version has diffrent function names. > > ?php > error_reporting (E_ALL); > set_time_limit (0); > $address = '192.168.1.2'; > $port = 4711; > if (($sock = socket_create (AF_INET, SOCK_STREAM, 0)) < 0) { > echo "socket() failed: reason: " . strerror ($sock) . "\n"; > } > if (($ret = socket_bind ($sock, $address, $port)) < 0) { > echo "bind() failed: reason: " . strerror ($ret) . "\n"; > } > if (($ret = socket_listen ($sock, 5)) < 0) { > echo "listen() failed: reason: " . strerror ($ret) . "\n"; > } > do { > if (($msgsock = socket_accept($sock)) < 0) { > echo "accept_connect() failed: reason: " . strerror ($msgsock) . > "\n"; > break; > } > do { > $buf = ''; > $ret = socket_read ($msgsock, $buf, 2048); > if ($ret < 0) { > echo "read() failed: reason: " . strerror ($ret) . "\n"; > break 2; > } > if ($ret == 0) { > break 2; > } > $buf = trim ($buf); > if ($buf == 'quit') { > close ($msgsock); > break 2; > } > $talkback = "PHP: You said '$buf'.\n"; > socket_write ($msgsock, $talkback, strlen ($talkback)); > echo "$buf\n"; > } while (true); > socket_close ($msgsock); > } while (true); > socket_close ($sock); > ?> > > The error message is always "Cannot bind the address" ?? > > Thanks very much > > Walter > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]