static void getNameBack(NetworkWarden ward) { warden = ward; Console.WriteLine("server sent spreadsheet: " + warden.message); ward.callNext = getNameBack; Networking.Send(ward, "trying to send chats" + "\n"); //Networking.Send(ward.socket, "#"); listenWarden = new NetworkWarden(ward.socket, ward.ID); getData(listenWarden); sendMessage(warden); //Thread ctThread = new Thread(getData(warden)); //ctThread.Start(); }
/// <summary> /// This is the event handler when the enter key is pressed in the messageToSend box /// </summary> /// <param name="sender">The Form control that fired the event</param> /// <param name="e">The key event arguments</param> private void MessageEnterHandler(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { // prevent the windows "ding" sound e.Handled = true; e.SuppressKeyPress = true; // Append a newline, since that is our protocol's terminating character for a message. string message = messageToSendBox.Text + "\n"; // Reset the textbox messageToSendBox.Text = ""; // Send the message to the server Networking.Send(theServer.TheSocket, message); } }
static void sendName(NetworkWarden ward) { ward.callNext = getNameBack; Networking.Send(ward, "Praise the Sun" + "\n"); }