Beispiel #1
0
 internal static void writePacket(NetworkStream stream, Packet packet)
 {
     lock (stream) {
         stream.WriteByte(packet.id);
         packet.write(stream);
     }
 }
Beispiel #2
0
 public void sendPacket(ClientConnection clientConnection, Packet p)
 {
     //println("Sending packet: " + p + "  " + ((p.id == StreamData.packetToId[typeof(PacketNewEntity)]) ? (((PacketNewEntity)p).entity.entityId+"") : ""));
     lock (clientConnection.stream) {
         p.writePacket(clientConnection.stream);
     }
 }
Beispiel #3
0
 public void sendPacketToAll(Packet p)
 {
     foreach(ClientConnection cc in connectedClients.Values){
         sendPacket(cc, p);
     }
 }
Beispiel #4
0
 internal void sendPacketToAllExcept(ClientConnection clientConnection, Packet p)
 {
     foreach (ClientConnection cc in connectedClients.Values) {
         if(cc.entityId != clientConnection.entityId){
             sendPacket(cc, p);
         }
     }
 }
Beispiel #5
0
 internal void sendPacket(Packet packet)
 {
     packet.writePacket(serverConnection.stream);
 }