Re: Problem with net.jxta.ext.config.Configurator

James Todd <[email protected]> Wed, 31 Aug 2005 07:52:55 -0700
Newsgroups gmane.comp.java.jxta.user
Message-ID <[email protected]>
The best bet is the unit tests:

  % cvs co platform
  % cd test/src/net/jxta/ext/config
  % vi TransportTest.java

Here's the basics:

        Configurator c = new Configurator();

        c.setName(NAME);
        c.setSecurity(PRINCIPAL, PASSWORD);

        //c.clearRendezVous();
        //c.clearRelays();
        //c.setRelayOutgoing(false);

        TcpTransportAddress ta = new TcpTransportAddress();

        try {
            URI u = new URI("tcp://" + TCP_ADDRESS + ":" + TCP_PORT);

            ta.setAddress(u);
        } catch (URISyntaxException use) {
            fail("TcpTransportAddress.setAddress() exception: " + 
use.getMessage());
        }

        MulticastAddress ma = new MulticastAddress();

        ma.setMulticast(true);
        ma.setSize(MULTICAST_SIZE);

        try {
            ma.setAddress(new URI("udp://" + MULTICAST_ADDRESS + ":" + 
MULTICAST_PORT));
        } catch (URISyntaxException use) {
            fail("MulticastAddress.setAddress() exception: " + 
use.getMessage());
        }
        catch (IllegalArgumentException iae) {
            fail("MulitcastAddress.setAddress() exception: " + 
iae.getMessage());
        }

        ta.setMulticastAddress(ma);

        TcpTransport tt = new TcpTransport();

        tt.setAddress(ta);
        c.setTransport(tt);

hth,

- james

--

James Todd :: blogs.sun.com/gonzo | weblogs.java.net/blog/gonzo

MyJXTA :: use it - learn it - do it

Java == platform independence
XML  == application independence
JXTA == network independence

Secure End-to-End Computing 



Marco Marconi wrote:

>On Mon, 29 Aug 2005 11:13:37 -0700
>James Todd <[email protected]> wrote:
>
>  
>
>>Excellent!
>>
>>You can specify the "home" in the backing Configurator constructor, as
>>
>>ext:config
>>does not require the System property "JXTA_HOME"
>>    
>>
>
>thank you again, Is there a way to set the tcp port for a peer other
>than name, password, home too? I can't find it in the docs.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [email protected]
>For additional commands, e-mail: [email protected]
>
>  
>