Reply to Re: [PHP] Server-Client connection via TCP port with PHP

Your name:

Reply:


Posted by Marco Tabini on 08/10/05 05:20

Hi Eli--

On 8/9/05 9:40 PM, "Eli" <eli.hen@gmail.com> 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

[Back to original 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

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