Example #1
0
    // 发送请求
    public static void SendMsg(Socket socket, IMessage data, ushort id)
    {
        var content   = data.ToByteArray();
        var byteArray = ProtoBufUtil.Encode(content, id);

        socket.BeginSend(byteArray, 0, byteArray.Length, SocketFlags.None, null, null);
        Debug.Log($"[Client]client send: ID:{id},DataLen:{content.Length}");
    }
Example #2
0
    // 发送请求
    public static void SendMsg(Socket socket, IMessage data, ushort id)
    {
        var content = data.ToByteArray();
        var msg     = ProtoBufUtil.Encode(content, id);

        socket.Send(msg);
        Console.WriteLine($"[Server] Server send: ID:{id},DataLen:{content.Length}");
    }