namespace server2 { public partial class server2 : Form { List<tcpclient> _clients = new List<tcpclient>(); _clients.Add(client1); _clients.Add(client2); public server2() { InitializeComponent(); } private void server2_Load(object sender, EventArgs e) { byte[] bt; bt = new byte[] { 127,0,0,1 }; IPAddress address = new IPAddress(bt); byte[] bt; bt = new byte[] { 127,0,1,1 }; IPAddress address = new IPAddress(bt); } private void send_Click(object sender, EventArgs e) { foreach (TcpClient client in _clients) { NetworkStream stream = client.GetStream(); BinaryWriter bwrite = new BinaryWriter(stream); bwrite.Write(txtServer.Text); } } private void add_Click(object sender, EventArgs e) { TcpClient client = new TcpClient(); string ipAddress = txtClientAddress.Text; client.Connect(ipAddress, PORT); _clients.Add(client); txtClientAddress.Text = ""; } } }
[edit]Code block added - OriginalGriff[/edit]
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)