示例#1
0
    public void SendPacket(int client, Packet_Server packet)
    {
        IntRef length = new IntRef();

        byte[] data             = ServerPackets.Serialize(packet, length);
        INetOutgoingMessage msg = new INetOutgoingMessage();

        msg.Write(data, length.value);
        clients[client].Connection.SendMessage(msg, MyNetDeliveryMethod.ReliableOrdered, 0);
    }
示例#2
0
    void SendRequest(NetClient client)
    {
        //Create request packet
        Packet_Client pp = ClientPackets.ServerQuery();

        //Serialize packet
        CitoMemoryStream ms = new CitoMemoryStream();

        Packet_ClientSerializer.Serialize(ms, pp);
        byte[] data = ms.ToArray();

        //Send packet to server
        INetOutgoingMessage msg = new INetOutgoingMessage();

        msg.Write(data, ms.Length());
        client.SendMessage(msg, MyNetDeliveryMethod.ReliableOrdered);
    }
示例#3
0
 public void SendPacket(byte[] packet, int packetLength)
 {
     //try
     //{
     INetOutgoingMessage msg = new INetOutgoingMessage();
     msg.Write(packet, packetLength);
     main.SendMessage(msg, MyNetDeliveryMethod.ReliableOrdered);
     //}
     //catch
     //{
     //    game.p.ConsoleWriteLine("SendPacket error");
     //}
 }
 public void SendPacket(int client, Packet_Server packet)
 {
     IntRef length = new IntRef();
     byte[] data = ServerPackets.Serialize(packet, length);
     INetOutgoingMessage msg = new INetOutgoingMessage();
     msg.Write(data, length.value);
     clients[client].Connection.SendMessage(msg, MyNetDeliveryMethod.ReliableOrdered, 0);
 }
示例#5
0
    void SendRequest(NetClient client)
    {
        //Create request packet
        Packet_Client pp = ClientPackets.ServerQuery();

        //Serialize packet
        CitoMemoryStream ms = new CitoMemoryStream();
        Packet_ClientSerializer.Serialize(ms, pp);
        byte[] data = ms.ToArray();

        //Send packet to server
        INetOutgoingMessage msg = new INetOutgoingMessage();
        msg.Write(data, ms.Length());
        client.SendMessage(msg, MyNetDeliveryMethod.ReliableOrdered);
    }