Skip to main content

Can one run JxtaSocket from A to B and A to C concurrently?

5 replies [Last post]
lmikhailov
Offline
Joined: 2007-05-22
Points: 0

Hello everybody!

Is it possible to concurrently use two JxtaSocket connections from a peer A to a peer B and from A to a peer C? The Peer A runs JxtaSocket while B and C run JxtaSocketServer and all instances of JxtaSocket and JxtaSocketServer are instantiated with the same PipeID.

Thanks,

Leon

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bondolo
Offline
Joined: 2003-06-11
Points: 0

Yes, there is a JxtaSocket constructor which allows you to specific the target peer you will be connecting to.

JxtaSocket(PeerGroup group, PeerID peerid, PipeAdvertisement pipeAdv, int timeout) throws IOException;

lmikhailov
Offline
Joined: 2007-05-22
Points: 0

That's cool. Can one use several JxtaSockets concurrently between A and B? Concurrent JxtaSockets would have to have different PipeID's, right? Would running several instances of JxtaSocket between two peers A and B increase the speed of file transfers, or would it be similar to consecutively sending these files through the same socket?

Thanks,

Leon

hamada
Offline
Joined: 2003-06-12
Points: 0

> That's cool. Can one use several JxtaSockets
> concurrently between A and B?

yes.
>Concurrent JxtaSockets
> would have to have different PipeID's, right?

No. JxtaSockets are no different than java.net.Socket

>Would
> running several instances of JxtaSocket between two
> peers A and B increase the speed of file transfers,
> or would it be similar to consecutively sending these
> files through the same socket?

Potentially yes. If one socket is not able to saturate a connection, then using multiple sockets could potentially increase throughput.

>
> Thanks,
>
> Leon

lmikhailov
Offline
Joined: 2007-05-22
Points: 0

>>Concurrent JxtaSockets
>> would have to have different PipeID's, right?

>No. JxtaSockets are no different than java.net.Socket

That's curious. I am not sure how java.net.Socket is supposed to behave. However I did try to transfer two .zip files through two concurrently running instances of JxtaSocket between the same peers and the received files ended up garbled. I thought that it's because I am supposed to have different PipeIDs for these JxtaSocket instances. I was using FileReceiver and FileSender from MyJXTA project which uses JxtaSockets internally.

Thanks,

Leon

lmikhailov
Offline
Joined: 2007-05-22
Points: 0

Hello everybody,

to send the files through JXTA sockets I use FileSender and FileReceiver from the myjxta project:
net.jxta.myjxta.plugins.filetransfer.FileSender
net.jxta.myjxta.plugins.filetransfer.FileReceiver

They work just fine until I start FileSenders on peers B and C and FileReceiver on A. FileReceiver uses a fixed PeerID and PipeID and starts a JxtaServerSocket, while FileSenders uses these IDs to create their instances of JxtaSocket. The files come to A all mixed up, clearly some FileReceiver gets confused about which packages belong to which file. So perhaps the problem is not with JxtaSockets but with FileSender/FileReceiver. I tried to see if I could fix FileSender/FileReceiver but I am not sure how FileReceiver could distinguish to which file a particular bytes belong. Unless, of course, they communicate on sockets with different PipeIDs.

I am sure JxtaSockets are used for file transfer. Does anybody know an implementation of FileSender/FileReceiver which would support concurrent file transmissions?

Thanks,

Leon