Re: Server-Client connection via TCP port with PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Eli--

On 8/9/05 9:40 PM, "Eli" <eli.hen@xxxxxxxxx> wrote:

> Hi,
> 
> I got a PHP program on my server. I want to open a live TCP port
> connection between my server to a client (client is developed in .NET,
> not regular HTTP browser).
> How can I do this using PHP?

You can use the socket functions in conjunction with TCP wrappers.

For example, take a look at fsockopen() in the manual:

http://ca.php.net/fsockopen

The resulting resource can be used with fwrite() and fread() and the likes
as if it were a file resource.

For more complex applications, you can use the actual socket API:

http://beeblex.com/manual/ref.sockets.html?s=man%3Asocket

Finally (since you mention you're connecting to a .Net app), maybe what you
need is a web service protocol like SOAP, in which case if you're using PHP
5 there is a built-in extension, whereas PHP 4 requires you to use a
userland library like the one provided by PEAR:

http://pear.php.net/package/soap/redirected

Cheers,


Marco

-- 
Marco Tabini
President & CEO

Marco Tabini & Associates, Inc.
28 Bombay Ave.
Toronto, ON M3H 1B7
Canada

Phone: +1 (416) 630-6202
Fax: +1 (416) 630-5057

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux