p2ps.imp.endpoint.UDP
Class UDPOutputEndpoint

java.lang.Object
  extended byp2ps.imp.endpoint.UDP.UDPEndpoint
      extended byp2ps.imp.endpoint.UDP.UDPOutputEndpoint
All Implemented Interfaces:
Endpoint, UDPEndpointSchemes

public class UDPOutputEndpoint
extends UDPEndpoint

An extension to UDPEndpoint that connects to a specfied endpoint address + port and always sends to that endpoint.

Version:
$Revision: 295 $
Author:
Ian Wang

Nested Class Summary
 
Nested classes inherited from class p2ps.imp.endpoint.UDP.UDPEndpoint
UDPEndpoint.DefaultInputMonitorFactory
 
Field Summary
 
Fields inherited from class p2ps.imp.endpoint.UDP.UDPEndpoint
MAX_DATAGRAM_SIZE, monfactory, RECEIVE_BUFFER_SIZE, SEND_BUFFER_SIZE, socket, SOCKET_TIMEOUT
 
Fields inherited from interface p2ps.imp.endpoint.UDP.UDPEndpointSchemes
UDP_MULTICAST, UDP_STANDARD
 
Constructor Summary
UDPOutputEndpoint()
           
UDPOutputEndpoint(int port)
           
UDPOutputEndpoint(UDPEndpoint endpoint)
           
 
Method Summary
 void connect(java.net.SocketAddress address)
          Connects the socket to the specified address
 void connect(java.lang.String address, int port)
          Connects the socket to the specified address
 java.net.URI getSendURI()
           
 boolean isOutputEndpoint()
           
 void send(byte[] message)
          Sends a message from the endpoint to the address the endpoint is bound to, with no sendid.
 void send(java.lang.String sendid, byte[] message)
          Sends a message from the endpoint to the address the endpoint is bound to, along with the send id for this message.
 
Methods inherited from class p2ps.imp.endpoint.UDP.UDPEndpoint
addEndpointMessageListener, close, getEndpointURI, getSocket, handleMessage, init, initSocket, isClosed, isInputEndpoint, removeEndpointMessageListener, send, send
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UDPOutputEndpoint

public UDPOutputEndpoint()
                  throws java.io.IOException

UDPOutputEndpoint

public UDPOutputEndpoint(int port)
                  throws java.io.IOException

UDPOutputEndpoint

public UDPOutputEndpoint(UDPEndpoint endpoint)
Method Detail

getSendURI

public java.net.URI getSendURI()
Specified by:
getSendURI in interface Endpoint
Overrides:
getSendURI in class UDPEndpoint
Returns:
the address being sent to by this endpoint (if known)

isOutputEndpoint

public boolean isOutputEndpoint()
Specified by:
isOutputEndpoint in interface Endpoint
Overrides:
isOutputEndpoint in class UDPEndpoint
Returns:
true if this endpoint is output enabled

connect

public void connect(java.lang.String address,
                    int port)
Connects the socket to the specified address


connect

public void connect(java.net.SocketAddress address)
Connects the socket to the specified address


send

public void send(byte[] message)
          throws java.io.IOException
Sends a message from the endpoint to the address the endpoint is bound to, with no sendid.

Specified by:
send in interface Endpoint
Overrides:
send in class UDPEndpoint
Throws:
java.io.IOException

send

public void send(java.lang.String sendid,
                 byte[] message)
          throws java.io.IOException
Sends a message from the endpoint to the address the endpoint is bound to, along with the send id for this message.

Specified by:
send in interface Endpoint
Overrides:
send in class UDPEndpoint
Throws:
java.io.IOException