Re: Trouble sending data via TCP socket
| From: | Martin Marques | Date: | Tue, 16 May 2006 11:32:16 +0000 |
| Subject: | Re: Trouble sending data via TCP socket | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-236274@lists.php.net to get a copy of this message | ||
On Mon, 15 May 2006, J. King wrote:
To further my understanding of how Jabber works I have decided I should try and write my own XMPP implementation in PHP. However, I've run into trouble rather quickly. To connect to a Jabber server, one must open a TCP socket to the server (typically through port 5269) send an XML-based stream header, wait for the server's confirmation and then log in, etc. As an initial test I tried to open a TCP socket, send a stream header, get the server's response, then disconnect. I did so thusly: $server = "jabber.org"; //example server $port = 5269; //default port $nsStream = "http://etherx.jabber.org/streams"; // Streams namespace $socket = stream_socket_client("tcp://$server:$port"); $header = "<stream:stream to='$server' xmlns='jabber:client' xmlns:stream='$nsClient' xml:lang='en' version='1.0'>"; [snip]
<stream:error> <invalid-namespaceWhat's the value of $nsClient??? I doesn't look like it's defined at all, so I would guess that your problem is there. -- 21:50:04 up 2 days, 9:07, 0 users, load average: 0.92, 0.37, 0.18 ---------------------------------------------------------xmlns='urn:ietf:params:xml:ns:xmpp-streams'/></stream:error>
Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática | '@' || 'unl.edu.ar';
Universidad Nacional | DBA, Programador,
del Litoral | Administrador
---------------------------------------------------------