This commit is contained in:
陈向学 2024-03-01 10:19:13 +08:00
parent d3f47116ae
commit 133e6f6534
1 changed files with 1 additions and 31 deletions

View File

@ -14,21 +14,12 @@ namespace GameServer
private static ConcurrentDictionary<string, TcpClient> clients = new ConcurrentDictionary<string, TcpClient>(); private static ConcurrentDictionary<string, TcpClient> clients = new ConcurrentDictionary<string, TcpClient>();
public static SubscriberSocket ToClientSubscriber; public static SubscriberSocket ToClientSubscriber;
public static PublisherSocket ToClientPublisher; public static PublisherSocket ToClientPublisher;
static string subPort = "";
static string pubPort = "";
static void Main(string[] args) static void Main(string[] args)
{ {
Task.Run(RunServer); Task.Run(RunServer);
ToClientPublisher = new PublisherSocket(); ToClientPublisher = new PublisherSocket();
ToClientPublisher.Bind("tcp://*:8888"); ToClientPublisher.Bind("tcp://*:8888");
ToClientSubscriber = new SubscriberSocket();
ToClientSubscriber.Bind("tcp://*:8889");
ThreadStart start1 = new ThreadStart(ReciveFormRoomSyncArea);
Thread thread1 = new Thread(start1);
thread1.IsBackground = true;
thread1.Start();
thread1.Join();
} }
static async Task RunServer() static async Task RunServer()
@ -160,27 +151,6 @@ namespace GameServer
client.Close(); client.Close();
} }
static void ReciveFormRoomSyncArea()
{
while (true)
{
List<byte[]> frameByte = new List<byte[]>();
if (ToClientSubscriber.TryReceiveMultipartBytes(ref frameByte))
{
if (!ToClientPublisher.SendMoreFrame(frameByte[0]).TrySendFrame(frameByte[1]))
{
Console.WriteLine("发送消息错误:" + frameByte[0]);
}
}
}
}
}
[Serializable]
public class st_Motions
{
public string area;
public int m_iOperaType;
public byte[] m_sOperaData;
} }
} }