private static void sendLoginSuccess(AsyncSocketServer server, Guid ConnectionID) { StreamPackage <ResultMessage> result = new StreamPackage <ResultMessage>(); result.Command = Command.Login; result.Data.Ret = 0; server.Send(ConnectionID, result.DataBytes()); }
private static void sendFriendsMessage() { StreamPackage <FriendsMessage> friendPost = new StreamPackage <FriendsMessage>(); friendPost.Command = Command.Friends; friendPost.Data.UID = Tools.RndInt(10000, 99999); client.Send(friendPost.DataBytes()); }
private static void sendLoginMessage() { StreamPackage <LoginMessage> loginPost = new StreamPackage <LoginMessage>(); loginPost.Command = Command.Login; loginPost.Data.UID = Tools.RndInt(10000, 99999); client.Send(loginPost.DataBytes()); }
private static void broadcastMessage(int uid) { StreamPackage <LabaMessage> labaPost = new StreamPackage <LabaMessage>(); labaPost.Command = Command.BigData; labaPost.Data.Data = uid.ToString() + "上线了!"; server.Broadcast(labaPost.DataBytes()); ServerMsg(labaPost.Data.Data); }
private static void sendBigMessage() { for (var i = 0; i < 10; i++) { StreamPackage <LabaMessage> bigPost = new StreamPackage <LabaMessage>(); bigPost.Command = Command.BigData; bigPost.Data.Data = "第" + i.ToString() + "个大数据:" + Tools.RndString(Tools.RndInt(100, 10000)); client.Send(bigPost.DataBytes()); ClientMsg(bigPost.Data.Data); } }
private static void sendFriendsMessage(AsyncSocketServer server, Guid ConnectionID) { StreamPackage <UsersMessage> usersMessage = new StreamPackage <UsersMessage>(); usersMessage.Command = Command.Friends; usersMessage.Data.List = new List <UserMessage>() { new UserMessage() { UID = 1, NickName = "11", Avatar = "111" }, new UserMessage() { UID = 2, NickName = "22", Avatar = "222" }, new UserMessage() { UID = 3, NickName = "33", Avatar = "333" } }; server.Send(ConnectionID, usersMessage.DataBytes()); }