Skip to main content

IM question

1 reply [Last post]
ziwy
Offline
Joined: 2007-08-09

Hi, I'm trying to build a simple instant messaging applcation...
I have a form I use to search for contact. Then I click Connect.

in the connect i do

this.outputPipe = pipe.createOutputPipe(pipeAdv, 10000);

this.inputPipe = pipe.createInputPipe(chatAdv,this);

where pipeAdv is the PipeAdvertisement I create,
and chatAdv is the PipeAdvertisement create by my contact.

The problem is that this things works only if we click connect almost
together, while I want that it works only with my connect click, without
his connect click.
I don't know if I explain well, I'm not English

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jimbosi
Offline
Joined: 2007-06-14

Hi there,

well, your message was 4 days ago, so I'm guessing you've probably solved this problem. Anyway, just in case you haven't, here's a few things to consider...

First of all, the inputPipe is really something you can create as soon as the peer group starts. It stays open until you close it or stop the peer group.

Also, you'll probably find you have a bit of a problem if all your peers use the one input pipe you create - you'll have to handle the message routing yourself. By that I mean, each message that your pipe receives will need to be sent to the correct chat window or whatever... it seems like it could be a pain.

Personally, I'd recommend using JxtaBiDiPipe and JxtaServerPipe which elminates a lot of the hassel of input and output pipes. JxtaBiDiPipes are actually built from input and output pipes anyway and behave almost exactly same. You just connect differently.

I think there's a fairly decent BiDiPipe example in the tutorials