public class TcpConnection extends Connection
| Modifier and Type | Class and Description |
|---|---|
(package private) class |
TcpConnection.NetLoop |
| Modifier and Type | Field and Description |
|---|---|
(package private) boolean |
isConnected |
(package private) static int |
MAGIC |
(package private) BinaryReader |
netReader |
(package private) Thread |
netThread |
(package private) BinaryWriter |
netWriter |
(package private) Socket |
sock |
connected, disconnected, netFilter, netMsgReceived| Constructor and Description |
|---|
TcpConnection() |
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
cleanup() |
void |
connect(IPEndPoint endPoint)
Connects to the specified end point.
|
(package private) void |
connectCompleted(Socket socket) |
void |
disconnect()
Disconnects this instance.
|
InetAddress |
getLocalIP()
Gets the local IP.
|
(package private) void |
readPacket() |
void |
send(IClientMsg clientMsg)
Sends the specified client net message.
|
onConnected, onDisconnected, onNetMsgReceivedstatic final int MAGIC
boolean isConnected
Socket sock
BinaryReader netReader
BinaryWriter netWriter
Thread netThread
public void connect(IPEndPoint endPoint)
connect in class ConnectionendPoint - The end point.void connectCompleted(Socket socket) throws IOException
IOExceptionpublic void disconnect()
disconnect in class Connectionpublic void send(IClientMsg clientMsg) throws IOException
send in class ConnectionclientMsg - The client net message.IOExceptionvoid readPacket()
void cleanup()
public InetAddress getLocalIP()
getLocalIP in class ConnectionCopyright © 2012. All Rights Reserved.