Lidgren 框架中的 NetException
NetException in Lidgren Framework
什么时候发生 Lidgren.Network.NetException: "This message has already sent! Use NetPeer.SendMessage() to send multiple recipients efficiently" ?
else if (CounfOfPlayers == 1)
{
Player2Connection = inc.SenderConnection;
Console.WriteLine(Player2Connection.RemoteEndPoint.ToString());
CounfOfPlayers++;
Console.WriteLine("Accepted second player");
outmsg.Write((byte)PacketType.RDY);
Server.SendMessage(outmsg, Player1Connection, NetDeliveryMethod.ReliableOrdered);
Server.SendMessage(outmsg, Player2Connection, NetDeliveryMethod.ReliableOrdered);
}
每个 NetOutgoingMessage
只能发送一次。
您应该使用 NetClient.CreateMessage()
根据 this 创建每个实例。
什么时候发生 Lidgren.Network.NetException: "This message has already sent! Use NetPeer.SendMessage() to send multiple recipients efficiently" ?
else if (CounfOfPlayers == 1)
{
Player2Connection = inc.SenderConnection;
Console.WriteLine(Player2Connection.RemoteEndPoint.ToString());
CounfOfPlayers++;
Console.WriteLine("Accepted second player");
outmsg.Write((byte)PacketType.RDY);
Server.SendMessage(outmsg, Player1Connection, NetDeliveryMethod.ReliableOrdered);
Server.SendMessage(outmsg, Player2Connection, NetDeliveryMethod.ReliableOrdered);
}
每个 NetOutgoingMessage
只能发送一次。
您应该使用 NetClient.CreateMessage()
根据 this 创建每个实例。