//Sends chat requests to other clients public void sendRequest() { user u = (user)ContactList.SelectedItem; try { if (inchat.Contains(u.ToString())) { return; } else { inchat.Add(u.ToString()); } TcpClient l = new TcpClient(u.getIp(), 5556); BinaryWriter w = new BinaryWriter(l.GetStream()); BinaryReader r = new BinaryReader(l.GetStream()); w.Write(this.Text); bool reply = r.ReadBoolean(); if (reply) { Application.Run(new WindowsFormsApplication2.chatForm(this.Text, u.ToString(), w, r)); } inchat.Remove(u.ToString()); w.Close(); r.Close(); l.Close(); Application.ExitThread(); } catch (Exception ex) { } }
//Sends chat requests to other clients public void sendRequest() { user u = (user)ContactList.SelectedItem; try { TcpClient l = new TcpClient(u.getIp(), 5556); BinaryWriter w = new BinaryWriter(l.GetStream()); BinaryReader r = new BinaryReader(l.GetStream()); w.Write(this.Text); bool reply = r.ReadBoolean(); if (reply) { Application.Run(new WindowsFormsApplication2.Form3(w, r)); } } catch (Exception ex) { } }