Skip to main content

Pipe ID

1 reply [Last post]
galato
Offline
Joined: 2007-07-06
Points: 0

Hi Jerome,

just a few more details on the PipeID issue just in case this can be relevant in other contexts as well.

In 2.4.1 I could issue this:
JxtaBiDiPipe myjxtabidipipe = (JxtaBiDiPipe) event.getSource();
clientPipeID = myjxtabidipipe.getPipeAdvertisement().getID().toString();

and get back the ID of the client that is connected to my server pipe. Trying this exact
code in 2.5 does not return the ID of the client anymore. I tried a few more things
such as
PipeID clientPipeID2 = event.getPipeID();
clientPipeID = clientPipeID2.toString();

because Mohamed mentioned once that he put a change in 2.5 to handle this and give me
back the client pipe - but it does not seem to work and it only returns the ephemeral
Pipe ID.

Any ideas anyone can have on this to help out that would be good - I need to get the
ID right after the event occurs (incoming message on the pipe). I will post this on the
forum as well.

Thanks in advance

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
galato
Offline
Joined: 2007-07-06
Points: 0

HI all,

Hi all,

you probably saw an earlier posting regarding a PipeID issue that I have with 2.5 that didn't exist with 2.4.1.
Until I am able to report this as an incident I wanted to ask a couple of questions to the list in case someone
has a few insights on the situation.

I agree with Jerome that there may have been some kind of a functionality loss between 2.5 and 2.4.1 in this
particular case. I use a JxtaBiDiPipe on a client peer to connect to a JxtaServer pipe. Each time a response
message will arrive from the server peer to the client peer, the PipeMsgEvent method that I implement in
my client application is called by the lower JXTA layers as expected. I use the following piece of code to extract
the PipeID of the JxtaBiDiPipe on which the event (arriving message) occured on:

JxtaBiDiPipe myjxtabidipipe = (JxtaBiDiPipe) event.getSource();
String myclientPipeID = myjxtabidipipe.getPipeAdvertisement().getID().toString();

However, this code does not work in 2.5 - I receive a cast exception at runtime. I noticed that in 2.4.1 the
PipeMsgEvent extens the net.jxta.util.java.util.EventObject whereas in 2.5 it extends the java.util.EventObject directly.
So I am wondering -
(1) why was this change implemented in 2.5? Just curious on the rationale behind it
(2) I don't see any other way to get the PipeID of the JxtaBiDiPipe to which a message has arrived at - unless I am
missing something. I thought may be one way to solve this was for the server pipe to send the PipeID of the client
pipe it is connected to each time it sends a message to that pipe but I think this is not a good solution at all.

I know 2.6 is the hot item these days so the issue above can take a back seat but if anyone has any more info
on this I will appreciate it if they can share it here.

Thanks and happy new year.