| Modifier and Type | Method and Description |
|---|---|
void |
acknowledgePacket(Acknowledgement acknowledgement) |
void |
bind(SocketAddress remoteAddress) |
void |
close() |
void |
connect(InetSocketAddress endpoint) |
static UtpSocket |
createInitiatingSocket(DatagramChannel channel,
short receiveConnectionId)
Creates a new
UtpSocket and configures it to be the initiating side. |
static UtpSocket |
createRemoteConnecting(DatagramChannel channel,
UtpPacket synPacket) |
void |
flush() |
ConnectionState |
getConnectionState() |
InputStream |
getInputStream() |
OutputStream |
getOutputStream() |
int |
getPacketPayloadSize() |
boolean |
isClosed() |
boolean |
isInputShutdown() |
boolean |
isOutputShutdown() |
boolean |
isShutdown() |
void |
onReceivedPacket(UtpPacket packet)
Updates the socket state based on the received packet.
|
void |
processSendQueue()
|
void |
processTimeout()
Validates if the socket is in timeout state or not.
|
void |
resend(UtpPacket packet)
Submits a packet that has been previously sent but has not arrived on the remote.
|
void |
send(ByteBuffer data)
Submits data to be send.
|
void |
setAcknowledgeNumber(short acknowledgeNumber) |
void |
setConnectionState(ConnectionState newState) |
void |
shutdownInputStream(short sequenceNumber) |
void |
submitData(short sequenceNumber,
byte[] data) |
String |
toString() |
public static UtpSocket createInitiatingSocket(DatagramChannel channel, short receiveConnectionId)
UtpSocket and configures it to be the initiating side.channel - The channel to write data on.receiveConnectionId - The ID on which this socket will receive data.public static UtpSocket createRemoteConnecting(DatagramChannel channel, UtpPacket synPacket)
public void bind(SocketAddress remoteAddress)
public void connect(InetSocketAddress endpoint) throws IOException
connect in interface ISocketIOExceptionpublic void onReceivedPacket(UtpPacket packet)
packet - The received packet.public void send(ByteBuffer data)
data - The buffer to be send.public void resend(UtpPacket packet)
packet - The packet to be resend.public void acknowledgePacket(Acknowledgement acknowledgement)
public void processSendQueue()
throws IOException
UtpPacket onto the channel if the window allows for it.
This will consume elements from resendQueue, sendQueue and packetAckHandlerIOExceptionpublic void processTimeout()
public int getPacketPayloadSize()
public InputStream getInputStream() throws IOException
getInputStream in interface ISocketIOExceptionpublic OutputStream getOutputStream() throws IOException
getOutputStream in interface ISocketIOExceptionpublic void close()
public void submitData(short sequenceNumber,
byte[] data)
public void shutdownInputStream(short sequenceNumber)
public boolean isInputShutdown()
isInputShutdown in interface ISocketpublic boolean isOutputShutdown()
isOutputShutdown in interface ISocketpublic boolean isShutdown()
public void setConnectionState(ConnectionState newState)
public ConnectionState getConnectionState()
public void setAcknowledgeNumber(short acknowledgeNumber)
Copyright © 2017. All rights reserved.