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); }
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); }
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"); //} }