Ignore:
Timestamp:
Jul 14, 2011 6:53:10 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
252f1047
Parents:
0ca035d
Message:
  • Streaming:
    • Hook I2CP ports through to I2PSocket
    • Javadocs, init cleanups, final
Location:
apps/ministreaming/java/src/net/i2p/client/streaming
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocket.java

    r0ca035d r9f433b2e  
    7171
    7272    public void setSocketErrorListener(SocketErrorListener lsnr);
     73
     74    /**
     75     *  The remote port.
     76     *  @return Default I2PSession.PORT_UNSPECIFIED (0) or PORT_ANY (0)
     77     *  @since 0.8.9
     78     */
     79    public int getPort();
     80
     81    /**
     82     *  The local port.
     83     *  @return Default I2PSession.PORT_UNSPECIFIED (0) or PORT_ANY (0)
     84     *  @since 0.8.9
     85     */
     86    public int getLocalPort();
     87
    7388    /**
    7489     * Allow notification of underlying errors communicating across I2P without
  • apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketImpl.java

    r0ca035d r9f433b2e  
    88import net.i2p.I2PAppContext;
    99import net.i2p.I2PException;
     10import net.i2p.client.I2PSession;
    1011import net.i2p.client.I2PSessionException;
    1112import net.i2p.data.Destination;
     
    301302    public long getCreatedOn() { return _createdOn; }
    302303    public long getClosedOn() { return _closedOn; }
     304   
     305    /**
     306     * The remote port.
     307     * @return 0 always
     308     * @since 0.8.9
     309     */
     310    public int getPort() {
     311        return I2PSession.PORT_UNSPECIFIED;
     312    }
     313
     314    /**
     315     * The local port.
     316     * @return 0 always
     317     * @since 0.8.9
     318     */
     319    public int getLocalPort() {
     320        return I2PSession.PORT_UNSPECIFIED;
     321    }
    303322   
    304323   
     
    672691        }
    673692    }
    674    
     693
    675694    @Override
    676695    public String toString() { return "" + hashCode(); }
  • apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketManagerFactory.java

    r0ca035d r9f433b2e  
    9191     * stream and connected to the default I2CP host and port.
    9292     *
    93      * @param myPrivateKeyStream private key stream
     93     * @param myPrivateKeyStream private key stream, format is specified in {@link net.i2p.data.PrivateKeyFile PrivateKeyFile}
    9494     * @return the newly created socket manager, or null if there were errors
    9595     */
     
    102102     * stream and connected to the default I2CP host and port.
    103103     *
    104      * @param myPrivateKeyStream private key stream
     104     * @param myPrivateKeyStream private key stream, format is specified in {@link net.i2p.data.PrivateKeyFile PrivateKeyFile}
    105105     * @param opts I2CP options
    106106     * @return the newly created socket manager, or null if there were errors
     
    115115     * port
    116116     *
    117      * @param myPrivateKeyStream private key stream
     117     * @param myPrivateKeyStream private key stream, format is specified in {@link net.i2p.data.PrivateKeyFile PrivateKeyFile}
    118118     * @param i2cpHost I2CP host
    119119     * @param i2cpPort I2CP port
  • apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketOptions.java

    r0ca035d r9f433b2e  
    33/**
    44 * Define the configuration for streaming and verifying data on the socket.
    5  *
     5 * Use I2PSocketManager.buildOptions() to get one of these.
    66 */
    77public interface I2PSocketOptions {
     
    8282     */
    8383    public void setWriteTimeout(long ms);
     84
     85    /**
     86     *  The remote port.
     87     *  @return Default I2PSession.PORT_UNSPECIFIED (0) or PORT_ANY (0)
     88     *  @since 0.8.9
     89     */
     90    public int getPort();
     91
     92    /**
     93     *  The remote port.
     94     *  @param port 0 - 65535
     95     *  @since 0.8.9
     96     */
     97    public void setPort(int port);
     98
     99    /**
     100     *  The local port.
     101     *  @return Default I2PSession.PORT_UNSPECIFIED (0) or PORT_ANY (0)
     102     *  @since 0.8.9
     103     */
     104    public int getLocalPort();
     105
     106    /**
     107     *  The local port.
     108     *  @param port 0 - 65535
     109     *  @since 0.8.9
     110     */
     111    public void setLocalPort(int port);
    84112}
  • apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketOptionsImpl.java

    r0ca035d r9f433b2e  
    55/**
    66 * Define the configuration for streaming and verifying data on the socket.
    7  *
     7 * Use I2PSocketManager.buildOptions() to get one of these.
    88 */
    99class I2PSocketOptionsImpl implements I2PSocketOptions {
     
    1212    private long _writeTimeout;
    1313    private int _maxBufferSize;
     14    private int _localPort;
     15    private int _remotePort;
    1416   
    1517    public static final int DEFAULT_BUFFER_SIZE = 1024*64;
     
    1719    public static final int DEFAULT_CONNECT_TIMEOUT = 60*1000;
    1820   
     21    /**
     22     *  Sets max buffer size, connect timeout, read timeout, and write timeout
     23     *  from System properties. Does not set local port or remote port.
     24     */
    1925    public I2PSocketOptionsImpl() {
    2026        this(System.getProperties());
    2127    }
    2228   
     29    /**
     30     *  Initializes from System properties then copies over all options.
     31     *  @param opts may be null
     32     */
    2333    public I2PSocketOptionsImpl(I2PSocketOptions opts) {
    2434        this(System.getProperties());
     
    2838            _writeTimeout = opts.getWriteTimeout();
    2939            _maxBufferSize = opts.getMaxBufferSize();
     40            _localPort = opts.getLocalPort();
     41            _remotePort = opts.getPort();
    3042        }
    3143    }
    3244
     45    /**
     46     *  Sets max buffer size, connect timeout, read timeout, and write timeout
     47     *  from properties. Does not set local port or remote port.
     48     *  @param opts may be null
     49     */
    3350    public I2PSocketOptionsImpl(Properties opts) {
    3451        init(opts);
    3552    }
    3653   
     54    /**
     55     *  Sets max buffer size, connect timeout, read timeout, and write timeout
     56     *  from properties. Does not set local port or remote port.
     57     *  @param opts may be null
     58     */
    3759    public void setProperties(Properties opts) {
    3860        if (opts == null) return;
     
    4769    }
    4870   
     71    /**
     72     *  Sets max buffer size, connect timeout, read timeout, and write timeout
     73     *  from properties. Does not set local port or remote port.
     74     */
    4975    protected void init(Properties opts) {
    5076        _maxBufferSize = getInt(opts, PROP_BUFFER_SIZE, DEFAULT_BUFFER_SIZE);
     
    145171        _writeTimeout = ms;
    146172    }
     173
     174    /**
     175     *  The remote port.
     176     *  @return Default I2PSession.PORT_UNSPECIFIED (0) or PORT_ANY (0)
     177     *  @since 0.8.9
     178     */
     179    public int getPort() {
     180        return _remotePort;
     181    }
     182
     183    /**
     184     *  The remote port.
     185     *  @param port 0 - 65535
     186     *  @since 0.8.9
     187     */
     188    public void setPort(int port) {
     189        _remotePort = port;
     190    }
     191
     192    /**
     193     *  The local port.
     194     *  @return Default I2PSession.PORT_UNSPECIFIED (0) or PORT_ANY (0)
     195     *  @since 0.8.9
     196     */
     197    public int getLocalPort() {
     198        return _localPort;
     199    }
     200
     201    /**
     202     *  The local port.
     203     *  @param port 0 - 65535
     204     *  @since 0.8.9
     205     */
     206    public void setLocalPort(int port) {
     207        _localPort = port;
     208    }
    147209}
Note: See TracChangeset for help on using the changeset viewer.