|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xsocket.datagram.Endpoint
public final class Endpoint
Endpoint implementation
Field Summary |
---|
Fields inherited from interface org.xsocket.datagram.IEndpoint |
---|
IP_MULTICAST_LOOP, IP_MULTICAST_TTL, IP_TOS, SO_BROADCAST, SO_RCVBUF, SO_REUSEADDR, SO_SNDBUF |
Constructor Summary | |
---|---|
Endpoint()
Constructs a datagram socket and binds it to any available port on the local host machine. |
|
Endpoint(DatagramSocketConfiguration socketConfiguration,
int receivePacketSize)
Deprecated. |
|
Endpoint(DatagramSocketConfiguration socketConfiguration,
int receivePacketSize,
IDatagramHandler datagramHandler)
Deprecated. |
|
Endpoint(DatagramSocketConfiguration socketConfiguration,
int receivePacketSize,
IDatagramHandler datagramHandler,
java.util.concurrent.Executor workerPool,
java.net.InetAddress address,
int port)
Deprecated. |
|
Endpoint(DatagramSocketConfiguration socketConfiguration,
int receivePacketSize,
IDatagramHandler datagramHandler,
java.net.InetAddress address,
int port)
Deprecated. |
|
Endpoint(int receivePacketSize)
Constructs a datagram socket and binds it to any available port on the local host machine. |
|
Endpoint(int receivePacketSize,
IDatagramHandler datagramHandler)
Constructs a datagram socket and binds it to any available port on the local host machine. |
|
Endpoint(int receivePacketSize,
IDatagramHandler datagramHandler,
java.util.concurrent.Executor workerPool)
Constructs a datagram socket and binds it to any available port on the local host machine. |
|
Endpoint(int receivePacketSize,
IDatagramHandler datagramHandler,
java.util.concurrent.Executor workerPool,
java.net.InetAddress address,
int port)
Constructs a datagram socket and binds it to the given port on the local host machine. |
|
Endpoint(int receivePacketSize,
IDatagramHandler datagramHandler,
java.net.InetAddress address,
int port)
Constructs a datagram socket and binds it to the given port on the local host machine. |
|
Endpoint(java.util.Map<java.lang.String,java.lang.Object> options,
int receivePacketSize,
IDatagramHandler datagramHandler,
java.util.concurrent.Executor workerPool,
java.net.InetAddress address,
int port)
Constructs a datagram socket and binds it to the given port on the local host machine. |
Method Summary | |
---|---|
void |
close()
|
java.lang.String |
getDefaultEncoding()
gets the default encoding used by this endpoint |
java.lang.String |
getId()
return the id |
java.net.InetAddress |
getLocalAddress()
returns the address of the endpoint |
int |
getLocalPort()
returns the port of the endpoint |
java.net.SocketAddress |
getLocalSocketAddress()
Deprecated. |
java.lang.Object |
getOption(java.lang.String name)
returns the vlaue of a option |
java.util.Map<java.lang.String,java.lang.Class> |
getOptions()
Returns an unmodifiable map of the options supported by this endpont. |
int |
getReceiveSize()
get the size of the datagram that will be received |
java.util.concurrent.Executor |
getWorkerpool()
return the worker pool |
IWorkerPool |
getWorkerPool()
Deprecated. |
boolean |
isOpen()
returns, if the endpoint is open |
UserDatagram |
receive()
receive a datagram packet (receive timeout = 0) |
UserDatagram |
receive(long timeoutMillis)
receive a datagram packet |
void |
send(UserDatagram packet)
send a datagram to the remote endpoint |
void |
setDefaultEncoding(java.lang.String defaultEncoding)
sets the default encoding used by this endpoint |
void |
setReceiveSize(int receivePacketSize)
set the size of the datagram that will be received |
void |
setWorkerPool(IWorkerPool workerPool)
Deprecated. |
java.lang.String |
toCompactString()
a compact string of this endpoint |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.xsocket.datagram.IEndpoint |
---|
getDefaultEncoding, getId, getLocalAddress, getLocalPort, getLocalSocketAddress, getOption, getOptions, getReceiveSize, isOpen, receive, receive, send, setDefaultEncoding, setReceiveSize, setWorkerPool |
Methods inherited from interface java.io.Closeable |
---|
close |
Constructor Detail |
---|
public Endpoint() throws java.io.IOException
java.io.IOException
- If some I/O error occurspublic Endpoint(int receivePacketSize) throws java.io.IOException
receivePacketSize
- the receive packet size
java.io.IOException
- If some I/O error occurspublic Endpoint(DatagramSocketConfiguration socketConfiguration, int receivePacketSize) throws java.io.IOException
java.io.IOException
public Endpoint(int receivePacketSize, IDatagramHandler datagramHandler) throws java.io.IOException
receivePacketSize
- the receive packet sizedatagramHandler
- the datagram handler
java.io.IOException
- If some I/O error occurspublic Endpoint(int receivePacketSize, IDatagramHandler datagramHandler, java.util.concurrent.Executor workerPool) throws java.io.IOException
receivePacketSize
- the receive packet sizedatagramHandler
- the datagram handlerworkerPool
- the workerPool
java.io.IOException
- If some I/O error occurspublic Endpoint(DatagramSocketConfiguration socketConfiguration, int receivePacketSize, IDatagramHandler datagramHandler) throws java.io.IOException
java.io.IOException
public Endpoint(int receivePacketSize, IDatagramHandler datagramHandler, java.net.InetAddress address, int port) throws java.io.IOException
receivePacketSize
- the receive packet sizedatagramHandler
- the datagram handleraddress
- the local addressport
- the local port which must be between 0 and 65535 inclusive.
java.io.IOException
- If some I/O error occurspublic Endpoint(DatagramSocketConfiguration socketConfiguration, int receivePacketSize, IDatagramHandler datagramHandler, java.net.InetAddress address, int port) throws java.io.IOException
java.io.IOException
public Endpoint(DatagramSocketConfiguration socketConfiguration, int receivePacketSize, IDatagramHandler datagramHandler, java.util.concurrent.Executor workerPool, java.net.InetAddress address, int port) throws java.io.IOException
java.io.IOException
public Endpoint(java.util.Map<java.lang.String,java.lang.Object> options, int receivePacketSize, IDatagramHandler datagramHandler, java.util.concurrent.Executor workerPool, java.net.InetAddress address, int port) throws java.io.IOException
options
- the socket optionsreceivePacketSize
- the receive packet sizedatagramHandler
- the datagram handleraddress
- the local addressport
- the local port which must be between 0 and 65535 inclusive.workerPool
- the workerPool
java.io.IOException
- If some I/O error occurspublic Endpoint(int receivePacketSize, IDatagramHandler datagramHandler, java.util.concurrent.Executor workerPool, java.net.InetAddress address, int port) throws java.io.IOException
receivePacketSize
- the receive packet sizedatagramHandler
- the datagram handleraddress
- the local addressport
- the local port which must be between 0 and 65535 inclusive.workerPool
- the workerPool
java.io.IOException
- If some I/O error occursMethod Detail |
---|
public final void close()
close
in interface java.io.Closeable
public final java.net.SocketAddress getLocalSocketAddress()
getLocalSocketAddress
in interface IEndpoint
public final java.net.InetAddress getLocalAddress()
getLocalAddress
in interface IEndpoint
public final int getLocalPort()
getLocalPort
in interface IEndpoint
public final boolean isOpen()
isOpen
in interface IEndpoint
public void send(UserDatagram packet) throws java.io.IOException
send
in interface IEndpoint
packet
- the datagram to send
java.io.IOException
- If some other I/O error occurs
ClosedConnectionException
- if the underlying channel is closedpublic java.lang.String toCompactString()
public java.lang.Object getOption(java.lang.String name) throws java.io.IOException
getOption
in interface IEndpoint
name
- the name of the option
java.io.IOException
- In an I/O error occurspublic java.util.Map<java.lang.String,java.lang.Class> getOptions()
IEndpoint
getOptions
in interface IEndpoint
public void setWorkerPool(IWorkerPool workerPool)
setWorkerPool
in interface IEndpoint
workerPool
- the worker pool to usepublic IWorkerPool getWorkerPool()
public java.util.concurrent.Executor getWorkerpool()
public final void setReceiveSize(int receivePacketSize)
setReceiveSize
in interface IEndpoint
receivePacketSize
- the receive sizepublic final int getReceiveSize()
getReceiveSize
in interface IEndpoint
public final UserDatagram receive(long timeoutMillis) throws java.io.IOException, java.net.SocketTimeoutException
receive
in interface IEndpoint
timeoutMillis
- the receive timeout in millis
java.net.SocketTimeoutException
- If the receive timeout has been reached
java.io.IOException
- If some other I/O error occurspublic UserDatagram receive()
IEndpoint
receive
in interface IEndpoint
public final java.lang.String getDefaultEncoding()
getDefaultEncoding
in interface IEndpoint
public final void setDefaultEncoding(java.lang.String defaultEncoding)
setDefaultEncoding
in interface IEndpoint
defaultEncoding
- the default encodingpublic final java.lang.String getId()
getId
in interface IEndpoint
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |