本文整理汇总了Java中org.xsocket.connection.INonBlockingConnection类的典型用法代码示例。如果您正苦于以下问题:Java INonBlockingConnection类的具体用法?Java INonBlockingConnection怎么用?Java INonBlockingConnection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
INonBlockingConnection类属于org.xsocket.connection包,在下文中一共展示了INonBlockingConnection类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onData
import org.xsocket.connection.INonBlockingConnection; //导入依赖的package包/类
public final boolean onData(INonBlockingConnection con)
{
final NetEvent event = new NetEvent(con);
server.serverPacketQueue.add(event);
return true;
}
示例2: onConnectionTimeout
import org.xsocket.connection.INonBlockingConnection; //导入依赖的package包/类
public final boolean onConnectionTimeout(INonBlockingConnection con)
{
final NetEvent event = new NetEvent(con, 1);
server.serverPacketQueue.add(event);
return true;
}
示例3: onIdleTimeout
import org.xsocket.connection.INonBlockingConnection; //导入依赖的package包/类
public final boolean onIdleTimeout(INonBlockingConnection con)
{
final NetEvent event = new NetEvent(con, 2);
server.serverPacketQueue.add(event);
return true;
}
示例4: onDisconnect
import org.xsocket.connection.INonBlockingConnection; //导入依赖的package包/类
public final boolean onDisconnect(INonBlockingConnection con)
{
final NetEvent event = new NetEvent(con, 3);
server.serverPacketQueue.add(event);
return true;
}
示例5: onConnect
import org.xsocket.connection.INonBlockingConnection; //导入依赖的package包/类
public final boolean onConnect(INonBlockingConnection con)
{
final NetEvent event = new NetEvent(con, 4);
server.serverPacketQueue.add(event);
return true;
}
示例6: onConnect
import org.xsocket.connection.INonBlockingConnection; //导入依赖的package包/类
@Override
public boolean onConnect(INonBlockingConnection iNonBlockingConnection) throws IOException, BufferUnderflowException
{
logger.info("Connection to socket server established");
connected = true;
return true;
}
示例7: onDisconnect
import org.xsocket.connection.INonBlockingConnection; //导入依赖的package包/类
@Override
public boolean onDisconnect(INonBlockingConnection iNonBlockingConnection) throws IOException
{
logger.info(String.format("Connection to socket server disconnected - retrying connect in %d seconds", RECONNECT_TIMEOUT_SECONDS));
connected = false;
tryReconnect();
return true;
}
示例8: onData
import org.xsocket.connection.INonBlockingConnection; //导入依赖的package包/类
@Override
public boolean onData(INonBlockingConnection connection)
{
String[] messages = getMessagesFromConnection(connection);
if (messages != null)
{
invokeCallbacksForMessages(messages);
}
return true;
}
示例9: getMessagesFromConnection
import org.xsocket.connection.INonBlockingConnection; //导入依赖的package包/类
private String[] getMessagesFromConnection(INonBlockingConnection connection)
{
String[] messages = null;
try
{
String content = connection.readStringByDelimiter(LINE_TERMINATION_STRING);
messages = content.split(LINE_TERMINATION_PATTERN);
} catch (Exception e)
{
logger.warn(String.format("Receiving data failed: %s", e.getMessage()));
}
return messages;
}
示例10: addPerson
import org.xsocket.connection.INonBlockingConnection; //导入依赖的package包/类
public final Player addPerson(INonBlockingConnection connection)
{
int newIndex = findIndex();
if (newIndex != -1)
{
Players[newIndex].connection = connection;
Players[newIndex].Index = newIndex;
Players[newIndex].inUse = true;
Players[newIndex].Verified = false;
Players[newIndex].State = 0;
Players[newIndex].Team = -1;
Players[newIndex].packet = null;
Players[newIndex].DisableUDP = false;
Players[newIndex].EstablishedUDP = false;
Players[newIndex].SendCounter = 0;
Players[newIndex].ReceiveCounter = -1;
Players[newIndex].GoodPackets = 0;
Players[newIndex].Score = 0;
Players[newIndex].X = 0;
Players[newIndex].Y = 0;
Players[newIndex].timeWarp = 0;
Players[newIndex].WarpIndex = 0;
Players[newIndex].MovedInPen = false;
Players[newIndex].timeSpawn = 0;
Players[newIndex].timeDead = 0;
Players[newIndex].MissileCharges = 0;
Players[newIndex].MissileRecharge = 0;
Players[newIndex].GrenadeCharges = 0;
Players[newIndex].GrenadeRecharge = 0;
Players[newIndex].BouncyCharges = 0;
Players[newIndex].BouncyRecharge = 0;
Players[newIndex].timeCorrectPosition = 0;
Players[newIndex].timeTeamSwitch = 0;
Players[newIndex].timestampLastEpoch = 0;
Players[newIndex].timestampLastTick = 0;
return Players[newIndex];
}
else
{
return null;
}
}
示例11: Player
import org.xsocket.connection.INonBlockingConnection; //导入依赖的package包/类
public Player(SparkServer server, INonBlockingConnection connection)
{
this.server = server;
this.connection = connection;
}
示例12: NetEvent
import org.xsocket.connection.INonBlockingConnection; //导入依赖的package包/类
public NetEvent(INonBlockingConnection con)
{
this.con = con;
this.Type = 0;
}