public Form1() { InitializeComponent(); _client = new Networking.Client("127.0.0.1", 10250); _client.Connect(); FormClosing += Form1_FormClosing; }
private void btnReconnect_Click(object sender, EventArgs e) { _client = new Client("127.0.0.1", 10250); if(_client.Connect()) { MessageBox.Show("Connected"); } else { MessageBox.Show("Failed"); } }
public FormMain() { InitializeComponent(); _client = new Client("127.0.0.1", 10250); if (!_client.Connect()) { _client = null; return; } _client.Disconnected += Client_Disconnected; _client.MessageReceived += Client_MessageReceived; FormClosing += FormMain_FormClosing; }