public void StartClient() { socket = HyperSocket.CreateClient("127.0.0.1", 8888, new ClientListener()); while (true) { var id = Console.ReadLine(); var str = Console.ReadLine(); var jsonObj = new JObject(); jsonObj.Add("id", int.Parse(id)); jsonObj.Add("msg", str); socket.SendUdp(jsonObj.AsBytes()); } }
public void OnOpen(HyperSocket socket) { // timeCaller1[i] = new TimeCaller(rd.Next(1000, 5000), rd.Next(500, 1000), true, -1, () => // { // socket.SendTcp(1.ToString()); // }); fff = true; Console.WriteLine($"Connect Num:{++num}"); // Console.WriteLine($"Connect OK:{socket.SessionId}"); timeCaller2[index++] = TimeCaller.Create(1000, 50, true, -1, (long count) => { socket.SendUdp(count.ToString()); }); }