Community Forums

Home » Vuze Forums » Open Development


Thread: get a list of Peer for every Torrent active


Thread Locked This thread is locked - replies are not allowed.


Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 5 - Pages: 1 - Last Post: Oct 29, 2008 4:41 PM Last Post By: amc1
robyp

Posts: 30
Registered: 07/19/08
get a list of Peer for every Torrent active
Posted: Oct 22, 2008 5:30 PM
Click to report abuse...
suppose i have a list of downloads active that my client have (list updated in addDownload and statechanged methods when a download is adding to me or change state from Queued/stop to downloading/seeding);

1)If i have an iterator to this list of my donwloads how can i get for every download the list of peers (Peer peers) in it???

2)I can resolve my problem using ? :
Download d
1- d.getPeerManager().getPeers()
2- "" . getPeers(address)

but
getPeers(String address) --> address ????? return Peer[]????

so if i must to check if a peer with adress 192.168.1.2 is in a list i suppose to use the second with parameter 192..but why it return an array of Peer??
i suppose that i have one peer 192.168.1.2 so it is only one???

thank you!
amc1


Posts: 1,170
Registered: 11/13/07
Re: get a list of Peer for every Torrent active
Posted: Oct 24, 2008 3:55 AM   in response to: robyp in response to: robyp
Click to report abuse...
d.getPeerManager().getPeers()
Just use this method - it looks like you figured out what to use anyway.
robyp

Posts: 30
Registered: 07/19/08
Re: get a list of Peer for every Torrent active
Posted: Oct 25, 2008 8:27 AM   in response to: amc1 in response to: amc1
Click to report abuse...
ok thanks.

then i tried to send a list of this peers( a string formated like: "the ip:port") collect with getPeers. I try to send a message for every peer so if i have n peers i send n messages -> THIS WORK FINE.

then i tried to send all peers togheter with a list!maybe it's better for performance (messages are light but..) to send only one message
with results collection..i think the message is sent but when a tried to get a list from a message field of type list i get this exception:

14:59:42.878 3 stderr DEBUG::Sat Oct 25 14:59:42 GMT+01:00 2008::com.aelitis.azureus.core.networkmanager.impl.MultiPeerDownloader::doProcessing::172:
14:59:42.888 3 stderr java.lang.ClassCastException: [B cannot be cast to java.lang.String
14:59:42.888 3 stderr at it.tesi.plugin.utils.Util.printerList(Util.java:159)
14:59:42.898 3 stderr at it.tesi.plugin.peer.PeerControllerImpl$3.messageReceived(PeerControllerImpl.java:244)
14:59:42.898 3 stderr at org.gudy.azureus2.pluginsimpl.local.network.IncomingMessageQueueImpl$1.messageReceived(IncomingMessageQueueImpl.java:52)
14:59:42.908 3 stderr at com.aelitis.azureus.core.networkmanager.impl.IncomingMessageQueueImpl.receiveFromTransport(IncomingMessageQueueImpl.java:137)
14:59:42.908 3 stderr at com.aelitis.azureus.core.networkmanager.impl.MultiPeerDownloader.doProcessing(MultiPeerDownloader.java:151)
14:59:42.908 3 stderr at com.aelitis.azureus.core.networkmanager.impl.ReadController.doRead(ReadController.java:293)
14:59:42.918 3 stderr at com.aelitis.azureus.core.networkmanager.impl.ReadController.doHighPriorityRead(ReadController.java:253)
14:59:42.918 3 stderr at com.aelitis.azureus.core.networkmanager.impl.ReadController.readProcessorLoop(ReadController.java:229)
14:59:42.918 3 stderr at com.aelitis.azureus.core.networkmanager.impl.ReadController.access$200(ReadController.java:43)
14:59:42.928 3 stderr at com.aelitis.azureus.core.networkmanager.impl.ReadController$2.runSupport(ReadController.java:88)
14:59:42.928 3 stderr at org.gudy.azureus2.core3.util.AEThread.run(AEThread.java:71)

Type B? what is it?
Anybody know what kind of cast i must to do? i know that String type are byte[] before to Cast a String but type B it's very strange.
I attach the message classe i used to send.

thank you
Roby

amc1


Posts: 1,170
Registered: 11/13/07
Re: get a list of Peer for every Torrent active
Posted: Oct 26, 2008 7:40 AM   in response to: robyp in response to: robyp
Click to report abuse...
[B is a byte array. Strings aren't types of byte arrays, and byte arrays aren't types of strings.

If you want to convert a string to a byte array, you call the getBytes method. If you want to construct a string from bytes, there's a constructor for the String class which does just that.

By the way - you have a lot of threads open on this, could you close those ones which you have finished with? I don't always have time to reply to your messages, but I do try to when I get time - but I need to know what things you still need help with.

Edited by: amc1 on 26-Oct-2008 14:40
robyp

Posts: 30
Registered: 07/19/08
Re: get a list of Peer for every Torrent active
Posted: Oct 27, 2008 6:47 AM   in response to: amc1 in response to: amc1
Click to report abuse...
ok i there was a mistake, i make a mistake to write that byte[] is casted to String, i know that new String() take a byte array for parameter, sorry i'll have to be more clearly. Ok this is the last message sorry if i have openend another thread for this question and not used the last i'v open before..

thank u very much.
amc1


Posts: 1,170
Registered: 11/13/07
Re: get a list of Peer for every Torrent active
Posted: Oct 29, 2008 4:41 PM   in response to: robyp in response to: robyp
Click to report abuse...
No problem - if there any threads you still want answer to, just bump the thread.
Legend
Master: 800 - 9999 pts
Expert: 400 - 799 pts
Advanced: 200 - 399 pts
Intermediate: 100 - 199 pts
Beginner: 50 - 99 pts
Newbie: 0 - 49 pts
Vuze Staff Member
Vuze Community Moderator
Helpful Answer (3 pts)
Correct Answer (5 pts)

Point your RSS reader here for a feed of the latest messages in all forums