You are here: PHP socket « PHP Programming Language « IT news, forums, messages
PHP socket

Posted by Boniface Frederic on 11/07/03 11:28

Hello,

I need to check if a user has properly open his port on his computer. He
will call a script specifing the port he want to use and the script will
have to check if he can open a socket on the IP:Port.
Here is a what I have tried but it doesn't work, even if the port is
properly open :

-----------------------------Script ------------------
<?php
ob_implicit_flush();

if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) < 0)
{
die("socket_create() failed : " . socket_strerror($sock) . "\n");
}

if (($ret = socket_connect($sock, $address, $port)) < 0)
{
die("socket_connect() failed : raison : " . socket_strerror ($ret) .
"\n");
}

echo "connected\n";

socket_close($sock);
?>
-------------------------End Script ---------------------

Any suggestions ? Thanks in advance.

Fred.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация