Gnutella Forums  

Go Back   Gnutella Forums > Current Gnutella Client Forums > Phex (Cross-platform) > Development & Coding > Development Open Discussion
Register FAQ The Twelve Commandments Members List Calendar Arcade Find the Best VPN Today's Posts

Development Open Discussion Anything else about the Phex development


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old May 23rd, 2009
Apprentice
 
Join Date: May 23rd, 2009
Posts: 5
codditor is flying high
Default coding questions

Hi,

First of all, i 'd like to thank you Gregor and Arne! Gongrats guys!

I want your help in order to grasp phex development quicker and why not contributing some code. I searched the forum but i didn't find something useful. So i have some newbie questions:
1) Can i run phex without gui? I didn't find such a setting.
2) If i know a file's name with its id and i know the ip of a servent that shares that file, which java class(es) should i use to download that file from that servent?
3) Does phex support browse-host extension?

Thanks a lot,
Geroge.
Reply With Quote
  #2 (permalink)  
Old May 24th, 2009
arne_bab's Avatar
Draketo, small dragon.
 
Join Date: May 31st, 2002
Location: Heidelberg, Germany
Posts: 1,881
arne_bab is a great assister to others; your light through the dark tunnel
Default

Hi codditor,

Firstoff: Welcome to the Phex forums!

From your questions I can only answer 1 and 3:

1) Yes: http://www.phex.org/wiki/index.php/A...headless.29.3F

Code:
java -Xmx512m -Djava.awt.headless=true -jar phex.jar
It still requires an X-server though, since Java depends on some of its functions.

Also you can't control it from there: You need to start it in GUI mode to setup your share downloads and preferences, then you can quit and restart in headless mode (we don't yet have commandline control).

3) Yes - just look in the search tab. When you click "new search" you have the option of selecting "browse host".

For 2 I sadly can't help directly.

I know that you need to initiate the download with the address of the host as first source - maybe that helps you.

What I did for subscriptions (with much help from Gregor) was this:

Code:
public void createDownload( String uriStr ) throws URIException
    {
        if (uriStr.length() == 0)
        {
            return;
        }
        URI uri = new URI( uriStr, true );
        Servent.getInstance().getDownloadService().addFileToDownload( uri, true );
    }
-> https://phex.svn.sourceforge.net/svn...ownloader.java

With phex.servent.Servent and org.apache.commons.httpclient.URI;

The URI was a magnet with a first source.

But I assume addFileToDownload() has a more convenient way to add a download with source (which doesn't require creating and then parsing an URI for the sole reason of passing a source - subscriptions were magnet uris, so this way was useful back then).
__________________

-> put this banner into your own signature! <-
--
Erst im Spiel lebt der Mensch.
Nur ludantaj homoj vivas.
GnuFU.net - Gnutella For Users
Draketo.de - Shortstories, Poems, Music and strange Ideas.
Reply With Quote
  #3 (permalink)  
Old May 24th, 2009
Apprentice
 
Join Date: May 23rd, 2009
Posts: 5
codditor is flying high
Default

Thank you Arne!
Reply With Quote
  #4 (permalink)  
Old May 30th, 2009
Phex Developer
 
Join Date: May 9th, 2001
Location: Stuttgart, Germany
Posts: 988
GregorK is flying high
Default

Please tell me if you need more help with anything.
__________________
Reply With Quote
  #5 (permalink)  
Old May 30th, 2009
Apprentice
 
Join Date: May 23rd, 2009
Posts: 5
codditor is flying high
Default

Quote:
Originally Posted by GregorK View Post
Please tell me if you need more help with anything.
Hi Gregor! Is there a class in phex with which i can download a specific file (knowing its name and its local index) directly from a servent (knowing its ip)?
Reply With Quote
  #6 (permalink)  
Old May 30th, 2009
Phex Developer
 
Join Date: May 9th, 2001
Location: Stuttgart, Germany
Posts: 988
GregorK is flying high
Default

You should do downloads using SHA1. Using of the file index is kind of deprecated and might stop working sooner or later.

To do downloads by SHA1 use:
Code:
URI uri = new URI( "http://<ip>:<port>/uri-res/N2R?urn:sha1:<SHA1>", true );
Servent.getInstance().getDownloadService().addFileToDownload( uri, true );
__________________
Reply With Quote
  #7 (permalink)  
Old May 30th, 2009
Apprentice
 
Join Date: May 23rd, 2009
Posts: 5
codditor is flying high
Default

Where do i find the SHA1 hash of servent's file?
Reply With Quote
  #8 (permalink)  
Old May 30th, 2009
Phex Developer
 
Join Date: May 9th, 2001
Location: Stuttgart, Germany
Posts: 988
GregorK is flying high
Default

ShareFile.getURN().getAsString()
returns urn:sha1:<SHA1> of a shared file in Phex in case it was already calculated.
__________________
Reply With Quote
  #9 (permalink)  
Old May 30th, 2009
Apprentice
 
Join Date: May 23rd, 2009
Posts: 5
codditor is flying high
Default

Thank you very much Gregor.
Are all shared files hashed through SHA1?
Where does ShareFile.getURN().getAsString() queries for the hash?
Reply With Quote
  #10 (permalink)  
Old May 30th, 2009
Phex Developer
 
Join Date: May 9th, 2001
Location: Stuttgart, Germany
Posts: 988
GregorK is flying high
Default

All files you share will be hashed once they are found the first time, this could take some time and getURN() will return null until there is a hash available.
The hash is saved to be available immediately after a Phex restart.
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 09:44 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.

Copyright © 2020 Gnutella Forums.
All Rights Reserved.