public Boolean createChannel() { SetState(ConnectionState.CHANNEL_CREATING); Boolean isSuccess = _client.Init(this); if (!isSuccess) { SetState(ConnectionState.CHANNEL_FAILED); } return(isSuccess); }
static int Init(IntPtr L) { try { ToLua.CheckArgsCount(L, 0); UDPClient.Init(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
private void button1_Click(object sender, EventArgs e) { System.Net.IPAddress ip; UInt16 usPort; if (!System.Net.IPAddress.TryParse(textBox1.Text, out ip)) { MessageBox.Show("Failed to parse the specified server IP address.", "Invalid user input", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!UInt16.TryParse(textBox2.Text, out usPort)) { MessageBox.Show("Failed to parse the specified server port number.", "Invalid user input", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } udp_client = new UDPClient(new System.Net.DnsEndPoint(ip.ToString(), usPort), true, 1, 10); udp_client.Init(this); }
static void Main(string[] args) { var s = new Base.MessageData(); s.desc = "12313"; Console.WriteLine(s.ToString()); var udpType = 0; var get = Console.ReadKey(); Console.WriteLine(); if (get.Key == ConsoleKey.Q) { UDPClient.Init(); UDPClient.GetRoomList(); udpType = 0; } else if (get.Key == ConsoleKey.W) { UDPServer.Init(); udpType = 1; } while (true) { string str = Console.ReadLine(); if (udpType == 0) { UDPClient.SendMsg(str); } else { UDPServer.SendMsg(str); } } }