Skip to main content

the problem of pipe communication behind nat

10 replies [Last post]
benus_ying
Offline
Joined: 2007-08-10

hi everyone:
i made a app.it can work well in my private network.but when i deployed it in internet,some troubles occured. two peers located in their own private network,all behind NAT.
they can find each other and create pipe communication through internet,but,can't get any msg from pipe.
i think the problem is that traversing NAT. In config dialog ,i choosed the http setting.but,i
didn't know if the checkbox "enable incoming connections" of http is necessary? and, when i choosed that, the error "Dynamic port selection not supported with incoming connections" would occur.Anyone knows the reason? or,tell me how to resolve it.

thanks.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
benus_ying
Offline
Joined: 2007-08-10

I captured all data by CommView and found PipeResolver Query which asks for creating pipe communication is send to 224.0.1.85. that ip address is a multi-cast address. Which means I can get multi-cast data if i join it. But,i never got any multi-cast data.
The process of creating pipe connection is "A sends PipeResolver Query to 224.0.1.85. B gets
that Query from 224.0.1.85, and then reponses a PipeResolver Answer to A. so, the Connection has created." . Which is my comprehension.Is it right?

benus_ying
Offline
Joined: 2007-08-10

I found a strange matter,my app will connect to 224.0.1.85 automatically,but, the MyJxta (from sun) never connects to that address.And, JxtaNetMap(from sun) sends Pipe Resolver Query to 192.18.37.36,but,my app sents Query to 224.0.1.85. Anybody knows the reason?

Message was edited by: benus_ying

timofiychuk
Offline
Joined: 2008-08-05

Hi. The address 224.0.1.85 - is a address of multicast jxta server. In MyJxta (from sun) multicast service is switched off. It use only direct connection without broadcast messaging. JxtaNetMap send request to the public jxta relay-peer (from sun) - 192.18.37.36.

perlotte
Offline
Joined: 2009-02-16

Hi,
Can I use JXTA and peersim together.

benus_ying
Offline
Joined: 2007-08-10

Sorry, finally I found that the pipes didn't connect to each other. The exception is "Output Pipe could not be resolved after 30000ms". Which is because of NAT? I create a sub peer group, and ,the rdv of the sub peer group is in subnet, not in internet.Pipe resove protocol must use sub peer group's rdv?
My code is divided into different classes,so, I don't sure which one i need to post.

Message was edited by: benus_ying

adamman71
Offline
Joined: 2007-01-31

Hi,

a) If both your peers are on the same LAN (i.e., subnet), NAT is not the problem. Both peers will be able to communicate with each other. UNLESS you have blocked the ports used by JXTA on your peers (think about firewall on your PC itself) or multicast is not allowed.

b) A peer can and will use multicast to find other peers on the LAN. However, if your other peers are behind a firewall or a NAT, JXTA uses other mechanisms to establish the communication. This may require a RELAY seed beyond your NAT or Firewall.

c) You must provide the ID of your sub group when creating the Pipe ID and you must use the service of your sub peer group to establish the communication. You are most probably 'inheriting' these services from the net peer group.

Hope this helps,

J.

rzorzorzo
Offline
Joined: 2005-10-16

Hi,

thanks for the answer. However it is not clear to me what you mean in c)

I am connecting to JXTA as follows:

manager = new NetworkManager(NetworkManager.ConfigMode.EDGE, name, new File(new File(".jxta"), name).toURI());
manager.getConfigurator().addRdvSeedingURI("http://rdv.jxtahosts.net/cgi-bin/rendezvous.cgi?");
manager.getConfigurator().addRelaySeedingURI("http://rdv.jxtahosts.net/cgi-bin/relays.cgi?");
manager.getConfigurator().setUseOnlyRendezvousSeeds(true);
manager.getConfigurator().setUseOnlyRelaySeeds(true);

System.out.println("Starting JXTA");
manager.startNetwork();
System.out.println("JXTA Started");

netPeerGroup = manager.getNetPeerGroup();
groupAdvertisement = netPeerGroup.getPeerGroupAdvertisement();
discovery = netPeerGroup.getDiscoveryService();
rendezvous = netPeerGroup.getRendezVousService();

I am creating the pipe ADV as follows:

pipeAdv =(PipeAdvertisement) AdvertisementFactory.newAdvertisement(
PipeAdvertisement.getAdvertisementType());
pipeAdv.setName(name);
PipeID pID = IDFactory.newPipeID(netPeerGroup .getPeerGroupID());
pipeAdv.setPipeID(pID);

I am opening a connection to the pipe as follows:

pipe = new JxtaBiDiPipe(netPeerGroup, pipeAdv, 50000, this, true);

However the above method returns a timeout exception.

I create a server pipe as follows:

JxtaServerPipe serverPipe = new JxtaServerPipe(netPeerGroup, pipeadv);
PipeListner pl = new PipeListner(serverPipe);
pl.start();

On the server peer the serverPipe.accept() returns a non null BidiPipe

Over the LAN everything works as expected.
Over WAN pipe advertisement and discovery functions as expected. However when the client pipe tries to open a connection to the server pipe a timeout exception is thrown.

What do you mean by "sub group" ?
What do you mean by "service of your sub peer group" ?

This is the last open issue for the next release of my project, so help to resolve this issue will be highly appreciated.

- Ron
http://sourceforge.net/projects/rzodyndns/

jeronimo
Offline
Joined: 2003-06-16

Well I am playing with the bidipipe example as well. I have 3 computers on my LAN.
I use one as a router/relay, one as the pipe server and one as the pipe client. To simulate NAT and firewalled situation, I activate the windows firewall on both the client and the server (but not on the relay/rendezvous node of course).
I run the bidipipe sample more or less _unmodified_.

At first I stumbled into a few problems, like correct rendez-vous and relay seeding. I have noticed that relay are not seeded via rendez-vous nodes, something I was naturally expecting. Moreover I think that there is no out-of-the-box way to balance the bandwidth load between several relay nodes. Anyway I may be expecting too much.

Then I noticed that for the relay to work, the node needs to fail to connect through directly to the target : well obvious when you think about it. However in the bidipipe example the pipe connection timeout is set to low to let that happen.
So rzor, if you have a timeout exception in the client, you may want to try to higher it a little bit, to test. Both the client and the server need to timeout on direct socket connection before trying the relay (this should appears in the logs). Moreover you need to seed a relay explicitly.

However I have myself a problem. I have tested having only the client node under a firewall and let the server free to get connected from outside : the pipe is not working anymore ! (of course when there is no firewall at all it is working also). The asymmetrical situation seems not to be handled correctly by the system. (I have cleaned all caches of all nodes).

Is is normal ? From what this may come ?
The messages seem to get corrupted. On the client, in:
public void pipeMsgEvent(PipeMsgEvent event)
The event.getMessage() return NULL !

Moreover, I have observed several times that in a direct connection scenario (without firewall), some messages are lost between the client and the server. Is this normal again ?

Here are the logs:
CLIENT LOGS:

[Connection 1] Attempting to establish a connection to : urn:jxta:uuid-59616261646162614E504720503250338944BCED387C4A2BB
D8E9411B78C284104
30 mars 2008 01:37:17 net.jxta.impl.pipe.InputPipeImpl
INFO: Creating InputPipe for urn:jxta:uuid-3F715DA628D4428B92E7972BB2869A363882BF02383244DB93D8EDFE34A248C204 of type Jx
taUnicast with listener
30 mars 2008 01:37:18 net.jxta.impl.pipe.NonBlockingOutputPipe
INFO: Constructing for urn:jxta:uuid-59616261646162614E504720503250338944BCED387C4A2BBD8E9411B78C284104
30 mars 2008 01:37:18 net.jxta.impl.pipe.NonBlockingOutputPipe startServiceThread
INFO: Thread start : Worker Thread for NonBlockingOutputPipe : urn:jxta:uuid-59616261646162614E504720503250338944BCED387
C4A2BBD8E9411B78C284104
worker state : ACQUIREMESSENGER queue closed : false number in queue : 0 number queued : 0 number d
equeued : 0
30 mars 2008 01:37:28 net.jxta.impl.pipe.NonBlockingOutputPipe run
INFO: Thread exit : Worker Thread for NonBlockingOutputPipe : urn:jxta:uuid-59616261646162614E504720503250338944BCED387C
4A2BBD8E9411B78C284104
worker state : SENDMESSAGES queue closed : false number in queue : 0 number queued : 1 number d
equeued : 1
30 mars 2008 01:37:39 net.jxta.impl.endpoint.tcp.TcpMessenger
INFO: Creating new TCP Connection to : tcp://192.168.0.200:9701 / 192.168.0.200:9701
[Connection 1] JxtaBiDiPipe pipe created
[Connection 1] Waiting for 10 more messages.
[Executor - 2] Received a message
Missing message element
[Executor - 9] Received a message
Missing message element
[Executor - 9] Received a message
Missing message element

SERVER LOGS:

INFO: Creating InputPipe for urn:jxta:uuid-59616261646162614E504720503250338944BCED387C4A2BBD8E9411B78C284104 of type JxtaUnicast with listener
Waiting for JxtaBidiPipe connections on JxtaServerPipe : urn:jxta:uuid-59616261646162614E504720503250338944BCED387C4A2BBD8E9411B78C284104
30 mars 2008 01:40:08 net.jxta.impl.endpoint.tcp.TcpMessenger
INFO: Connection from 192.168.0.199:2049
30 mars 2008 01:40:10 net.jxta.impl.endpoint.tcp.TcpMessenger
INFO: Creating new TCP Connection to : tcp://192.168.0.199:9701 / 192.168.0.199:9701
30 mars 2008 01:40:31 net.jxta.impl.endpoint.tcp.TcpTransport getMessenger
ATTENTION: Could not get messenger for tcp://192.168.0.199:9701/EndpointService:uuid-3F715DA628D4428B92E7972BB2... : Connection timed out: connect
30 mars 2008 01:40:31 net.jxta.impl.pipe.InputPipeImpl
INFO: Creating InputPipe for urn:jxta:uuid-3F715DA628D4428B92E7972BB2869A365816338DEE0344848B96E44D54F0069304 of type JxtaUnicast with listener
30 mars 2008 01:40:31 net.jxta.impl.util.pipe.reliable.ReliableInputStream
INFO: Listener based ReliableInputStream created
JxtaBidiPipe accepted from urn:jxta:uuid-59616261646162614E50472050325033A5428A5ACCF74AEDBD28B10547CEB78603 : urn:jxta:uuid-3F715DA628D4428B92E7972BB2869A363882BF02383244DB93D8EDFE34A248C204 sending 10 messages.
[Connection Handler 1] Sending message :0 while pipe is bound=true
30 mars 2008 01:40:31 net.jxta.impl.util.pipe.reliable.ReliableOutputStream$Retransmitter
INFO: STARTED Reliable Retransmitter, RTO = 600000
[Connection Handler 1] Sending message :1 while pipe is bound=true
[Connection Handler 1] Sending message :2 while pipe is bound=true
[Connection Handler 1] Sending message :3 while pipe is bound=true
30 mars 2008 01:40:31 net.jxta.impl.endpoint.tcp.TcpMessenger
INFO: Connection from 192.168.0.199:2050

SUPERNODE LOGS:
Mar 30, 2008 12:39:27 AM net.jxta.impl.pipe.InputPipeImpl
INFO: Creating InputPipe for urn:jxta:uuid-59616261646162614E50472050325033DEADBEEFDEAFBABAFEEDBABE0000000F04 of type JxtaPropagate with listener
Mar 30, 2008 12:39:27 AM net.jxta.impl.pipe.WirePipe register
INFO: Registering urn:jxta:uuid-59616261646162614E50472050325033DEADBEEFDEAFBABAFEEDBABE0000000F04 with pipe resolver.
Mar 30, 2008 12:39:28 AM net.jxta.impl.pipe.InputPipeImpl
INFO: Creating InputPipe for urn:jxta:uuid-3F715DA628D4428B92E7972BB2869A365065657256694577B575A9642D33463704 of type JxtaPropagate with listener
Mar 30, 2008 12:39:28 AM net.jxta.impl.pipe.WirePipe register
INFO: Registering urn:jxta:uuid-3F715DA628D4428B92E7972BB2869A365065657256694577B575A9642D33463704 with pipe resolver.
Mar 30, 2008 12:39:28 AM net.jxta.impl.pipe.NonBlockingWireOutputPipe
INFO: Constructing for urn:jxta:uuid-3F715DA628D4428B92E7972BB2869A365065657256694577B575A9642D33463704
Mar 30, 2008 12:39:28 AM net.jxta.impl.rendezvous.rpv.PeerView openWirePipes
INFO: Propagate Pipes opened.
Mar 30, 2008 12:39:28 AM net.jxta.impl.pipe.NonBlockingWireOutputPipe
INFO: Constructing for urn:jxta:uuid-59616261646162614E50472050325033DEADBEEFDEAFBABAFEEDBABE0000000F04
Mar 30, 2008 12:39:36 AM net.jxta.impl.rendezvous.rpv.PeerView seed
INFO: New Seeding...
Mar 30, 2008 12:39:39 AM net.jxta.impl.endpoint.tcp.TcpMessenger
INFO: Connection from 192.168.0.200:2268
Mar 30, 2008 12:39:39 AM net.jxta.impl.endpoint.relay.RelayServer run
INFO: Starting lease gc thread
Mar 30, 2008 12:39:41 AM net.jxta.impl.endpoint.tcp.TcpMessenger
INFO: Connection from 192.168.0.200:2269
Mar 30, 2008 12:40:06 AM net.jxta.impl.endpoint.tcp.TcpMessenger
INFO: Connection from 192.168.0.199:2047
Mar 30, 2008 12:40:07 AM net.jxta.impl.endpoint.tcp.TcpMessenger
INFO: Connection from 192.168.0.199:2048
Mar 30, 2008 12:40:21 AM net.jxta.impl.rendezvous.rpv.PeerView seed

PS: sorry for topic squatting.

Message was edited by: jeronimo

faisalabbas
Offline
Joined: 2007-12-11

HELLO
ATTACHED CODE WILL BE HELP FULL TO SOLVE YOUR PROBLEM
BYEE

rzorzorzo
Offline
Joined: 2005-10-16

Hi,

I have the same problem. where is the code you mention ?

- Ron