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, onNetMsgReceived
static final int MAGIC
boolean isConnected
Socket sock
BinaryReader netReader
BinaryWriter netWriter
Thread netThread
public void connect(IPEndPoint endPoint)
connect
in class Connection
endPoint
- The end point.void connectCompleted(Socket socket) throws IOException
IOException
public void disconnect()
disconnect
in class Connection
public void send(IClientMsg clientMsg) throws IOException
send
in class Connection
clientMsg
- The client net message.IOException
void readPacket()
void cleanup()
public InetAddress getLocalIP()
getLocalIP
in class Connection
Copyright © 2012. All Rights Reserved.