Skip to main content

Using JXTA with PHP Sockets

2 replies [Last post]
Joined: 2009-05-02

I'll try and explain this as best that I can. If I need to clarify something, then just let me know. I have a rendezvous server which listens on the two common ports that JXTA uses (9700 and 9701). I have a php script in which I am using a socket to connect to the rendezvous on port 9701 at its public ip address. I'm a total noob when it comes to server request/response messages, so I'm not sure if I am even doing this right. So far this is what my php script looks like. Obviously the public ip goes where it says , I just left it out for security reasons.

<?php<br />
	$fp = fsockopen("",9701,$errno,$errdesc);<br />
	echo $fp;<br />
	$request = "Request:<br />
	GET / HTTP/1.1";<br />
	fputs($fp,$request);<br />
	while(!feof($fp))<br />
	{<br />
		$page[] = fgets($fp, 1024);<br />
	}<br />
	for($i=0; $i

The code seems to work because I get a JXTAHELLO message as a response. The message just has a source ip, destination ip, and a jxta peerid. Now my question is would it be possible to send like a resolver query message to the server using this php socket, have the peer process the query, and then send out a resolver response message that can then be parsed to show certain information from the response onto a web page? I am trying to make this web page as a sort of way to search my p2p network without necessarily having to download the software.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-06-12

it is possible to do, if you implement the JXTA wire-binary and message protocols in php.

Joined: 2007-01-31

I have never heard anybody trying this, but assuming that your query message has the proper structure, it might be feasible. I am, however, wondering about the routing for the answer message. I think you may run into troubles.

Another idea is to try to enable the HTTP inbound communication in the 'queried' peer and poke it via that communication protocol. It might be easier to retrieve the answer.

Honestly, I believe the definitive answers on this one will come by trying these ideas...