| Modifier and Type | Class and Description |
|---|---|
static class |
UtpSocketImpl.Builder
The class capable of building
UtpSocketImpl instances progressively. |
| Constructor and Description |
|---|
UtpSocketImpl(UtpMultiplexer utpMultiplexer)
Creates a new socket which is considered the initiating endpoint
|
UtpSocketImpl(UtpMultiplexer utpMultiplexer,
SocketAddress socketAddress,
short connectionId)
Creates a new socket which is considered the accepting endpoint.
|
| Modifier and Type | Method and Description |
|---|---|
void |
bindIoStreams(short sequenceNumber)
Initialises the input and output stream of this socket.
|
void |
close()
Initiates the socket shutdown.
|
void |
connect(InetSocketAddress endpoint)
Attempts to connect the socket to the given endpoint.
|
short |
getAcknowledgeNumber() |
int |
getBytesInFlight() |
ConnectionState |
getConnectionState() |
short |
getEndOfStreamSequenceNumber() |
UtpInputStream |
getInputStream() |
int |
getMeasuredDelay() |
UtpOutputStream |
getOutputStream() |
int |
getPacketSize() |
short |
getReceivingConnectionId() |
short |
getSendingConnectionId() |
short |
getSequenceNumber() |
int |
getWindowSize() |
void |
handleClose()
Handles the period between
ConnectionState.DISCONNECTING and ConnectionState.CLOSED. |
void |
handleTimeout()
Handles the timeout case if one occurred.
|
boolean |
isInputShutdown()
Verifies if there is still the possibility that more packets are to be received.
|
boolean |
isOutputShutdown()
Verifies if data can still be written on this socket.
|
short |
nextSequenceNumber() |
void |
onReceivedData()
Called when a
DataPayload has been received. |
void |
onReset()
This method should be triggered when a RESET packet is received.
|
void |
process(UtpPacket packet)
Processes the payload of the given
packet and updates the socket state accordingly. |
void |
send(IPayload payload)
Writes the given payload with respect to the
window. |
void |
sendUnbounded(UtpPacket packet)
Send a packet without honoring the
window. |
void |
setEndOfStreamSequenceNumber(short sequenceNumber) |
String |
toString() |
public UtpSocketImpl(UtpMultiplexer utpMultiplexer)
utpMultiplexer - The multiplexer on which this socket will be registered.public UtpSocketImpl(UtpMultiplexer utpMultiplexer, SocketAddress socketAddress, short connectionId)
utpMultiplexer - The multiplexer on which this socket will be registered.socketAddress - The socket address on which the remote end is listening.connectionId - The connection id which we will use to send packets with.public void connect(InetSocketAddress endpoint) throws IOException
endpoint - The address on which a client is expected to be listening.IOException - When the connection cannot be established.public void send(IPayload payload) throws IOException
window.payload - The payload to send.IOException - When an IO error occurs.public void sendUnbounded(UtpPacket packet) throws IOException
window.packet - The packetIOExceptionsend(IPayload)public void onReceivedData()
DataPayload has been received.public UtpInputStream getInputStream() throws IOException
IOExceptionpublic UtpOutputStream getOutputStream() throws IOException
IOExceptionpublic int getBytesInFlight()
public void process(UtpPacket packet) throws IOException
packet and updates the socket state accordingly.packet - The packet to process.IOException - When the payload cannot be processed.public void onReset()
throws IOException
IOExceptionpublic void bindIoStreams(short sequenceNumber)
sequenceNumber - The sequence number of the packet which is the last packet of the connection establishment.getInputStream(),
getOutputStream()public void handleTimeout()
throws IOException
IOExceptionpublic void handleClose()
ConnectionState.DISCONNECTING and ConnectionState.CLOSED.public void close()
throws IOException
IOExceptionpublic boolean isInputShutdown()
true when data can still be received, otherwise false.public boolean isOutputShutdown()
true when data can still be written, otherwise false.public short getAcknowledgeNumber()
public short nextSequenceNumber()
public short getReceivingConnectionId()
public short getSendingConnectionId()
public int getMeasuredDelay()
public int getWindowSize()
public int getPacketSize()
public ConnectionState getConnectionState()
public void setEndOfStreamSequenceNumber(short sequenceNumber)
public short getEndOfStreamSequenceNumber()
public short getSequenceNumber()
Copyright © 2016. All rights reserved.