You are here: Sockets and writing binary data in php « All PHP « IT news, forums, messages
Sockets and writing binary data in php

Posted by Henk on 06/07/05 17:38

Hello,

I'm working with the socket functions from php and connect to a socket
server, written in c++.
I can send (text) strings from php to the server, but I would like to know
how I can send a binary stream. I would like to send the string WITH the
terminating zero over the socket. I would like to do this because it's
possible on the receive side that I receive more than one message at once
(because it's a stream).

if (!socket_connect($sock, $address, $port))
{

}
else
{
socket_write($sock, $msg,$length);
}

so the $msg should be modified to a binary string so that the socket write
function includes the terminating zero. Or should I use other functions to
encode the data before sending it over the socket?

regards,
Henk

 

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

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