Example #1
0
 private void ThreadStart()
 {
     ChatSocket.StartServer(miNombre, txt_DireccionIpLocal.Text, txt_PuertoLocal.Text);
     conectado = true;
     server    = true;
     t1        = new Thread(ChatSocket.RecieveMessage);
     t1.Start();
 }
Example #2
0
 private void StartClient()
 {
     if (txt_DireccionIpRemota.Text == "")
     {
         txt_DireccionIpRemota.Text = "localhost";
     }
     ChatSocket.StartClient(miNombre, txt_DireccionIpRemota.Text, txt_PuertoRemoto.Text);
     server = false;
     t3     = new Thread(ChatSocket.ClientRecieveMessage);
     t3.Start();
 }
Example #3
0
 private void IngresarNombre(object sender, KeyPressEventArgs e)
 {
     if (txt_Nombre.Text != "")
     {
         if (e.KeyChar == (char)13)
         {
             miNombre = txt_Nombre.Text;
             System.IO.File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\AppData\Local\Temp\SimpleChatName.txt", miNombre);
             panel_Inicio.Visible = false;
             ChatSocket.SetupServer();
             txt_DireccionIpLocal.Text = ipLocal;
             txt_PuertoLocal.Text      = "11000";
         }
     }
 }
Example #4
0
 private void SendMessage(String message)
 {
     //MessageBox.Show("Eres un " + (server == true ? "server" : "cliente"));
     if (message != "")
     {
         if (server)
         {
             t2 = new Thread(ChatSocket.ServerSendMessage);
             t2.Start();
             ChatSocket.data = message;
         }
         else
         {
             ChatSocket.SendMessage(message);
         }
     }
 }