public class UdpConnection extends Connection
| Modifier and Type | Class and Description | 
|---|---|
| (package private) class  | UdpConnection.NetLoop | 
| Modifier and Type | Field and Description | 
|---|---|
| private int | AHEAD_COUNTMaximum number of packets that we can be waiting on at a time. | 
| private Map<Integer,UdpPacket> | inPackets | 
| private int | inSeqThe sequence number we plan on acknowledging receiving with the next Ack. | 
| private int | inSeqAckedThe highest sequence number we've acknowledged receiving. | 
| private int | inSeqHandledThe highest sequence number we've processed. | 
| private Thread | netThread | 
| private Date | nextResend | 
| private List<UdpPacket> | outPackets | 
| private int | outSeqThe next outgoing sequence number to be used. | 
| private int | outSeqAckedThe sequence number of the highest packet acknowledged by the server. | 
| private int | outSeqSentThe highest sequence number of an outbound packet that has been sent. | 
| private int | remoteConnId | 
| private IPEndPoint | remoteEndPoint | 
| private int | RESEND_COUNTMaximum number of packets to resend when RESEND_DELAY is exceeded. | 
| private int | RESEND_DELAYSeconds to wait before sending packets. | 
| private DatagramSocket | sock | 
| private int | sourceConnId | 
| private UdpState | stateContains information about the state of the connection, used to filter out packets that are
 unexpected or not valid given the state of the connection. | 
| private Date | timeOut | 
| private int | TIMEOUT_DELAYSeconds to wait before considering the connection dead. | 
connected, disconnected, netFilter, netMsgReceived| Constructor and Description | 
|---|
| UdpConnection() | 
| Modifier and Type | Method and Description | 
|---|---|
| void | connect(IPEndPoint endPoint)Connects to the specified CM server. | 
| void | disconnect()Disconnects this instance, blocking until the queue of messages is empty or the connection
 is otherwise terminated. | 
| private boolean | dispatchMessage()Dispatches up to one message to the rest of SteamKit | 
| InetAddress | getLocalIP()Gets the local IP. | 
| private int | readyMessageParts()Returns the number of message parts in the next message. | 
| private void | receiveAccept(UdpPacket packet)Receives the notification of an accepted connection and sets the connection id that will be used for the
 connection's duration. | 
| private void | receiveChallenge(UdpPacket packet)Receives the challenge and responds with a Connect request | 
| private void | receiveData(UdpPacket packet)Receives typical data packets before dispatching them for consumption by the rest of SteamKit | 
| private void | receivePacket(UdpPacket packet)Receives the packet, performs all sanity checks and then passes it along as necessary. | 
| void | send(IClientMsg clientMsg)Serializes and sends the provided message to the server in as many packets as is necessary. | 
| private void | sendAck()Sends a datagram Ack, used when an Ack needs to be sent but there is no data response to piggy-back on. | 
| private void | sendData(BinaryReader ms)Sends the data sequenced as a single message, splitting it into multiple parts if necessary. | 
| private void | sendPacket(UdpPacket packet)Sends a packet immediately. | 
| private void | sendPendingMessages()Sends or resends sequenced messages, if necessary. | 
| private void | sendSequenced(UdpPacket packet)Sends the packet as a sequenced, reliable packet. | 
| private void | sendSequenced(UdpPacket[] packets)Sends the packets as one sequenced, reliable net message. | 
onConnected, onDisconnected, onNetMsgReceivedprivate final int RESEND_DELAY
private final int TIMEOUT_DELAY
private final int RESEND_COUNT
private final int AHEAD_COUNT
private UdpState state
private Thread netThread
private DatagramSocket sock
private IPEndPoint remoteEndPoint
private Date timeOut
private Date nextResend
private int sourceConnId
private int remoteConnId
private int outSeq
private int outSeqSent
private int outSeqAcked
private int inSeq
private int inSeqAcked
private int inSeqHandled
public void connect(IPEndPoint endPoint)
connect in class ConnectionendPoint - The CM server.public void disconnect()
disconnect in class Connectionpublic void send(IClientMsg clientMsg)
send in class ConnectionclientMsg - The ClientMsgprivate void sendData(BinaryReader ms)
ms - The data to send.private void sendSequenced(UdpPacket packet)
packet - The packet.private void sendSequenced(UdpPacket[] packets)
packets - The packets that make up the single net messageprivate void sendPacket(UdpPacket packet)
packet - The packet.private void sendAck()
private void sendPendingMessages()
private int readyMessageParts()
private boolean dispatchMessage()
private void receivePacket(UdpPacket packet)
packet - The packet.private void receiveChallenge(UdpPacket packet)
packet - The packet.private void receiveAccept(UdpPacket packet)
packet - private void receiveData(UdpPacket packet)
packet - The packet.public InetAddress getLocalIP()
ConnectiongetLocalIP in class ConnectionCopyright © 2012. All Rights Reserved.