Socket question
-
Hey all, I'm new to web app dev so I'll ask a simple question.. I created a simple chat application with client & server sockets. after initialation & establishing the connection, I send text message to the server. when I send the first message, the server gets it and displays it, now, I realized that after the client sends the first message to the server, I need to reconnect to it again in order to send another message(s).. The question is Do I need to reconnect to the server everytime, even though I have the server & client socket objects initialized... my client code is like this: private void btnSend_Click(object sender, System.EventArgs e) { btnConnect_Click(sender, e);//without this proc. I can send only 1 msg try{ string msg = TxtSnd.Text+""; byte[] byteData = Encoding.ASCII.GetBytes(msg); lblstts.Text = "Sendeing...";//status label clientMe.Send(byteData); TxtSnd.Text = "";//delete text from TextBox }catch(Exception Ex) { MessageBox.Show(Ex.Message); } }