Значит есть код
static void Main(string[] args)
{
TcpListener listner = new TcpListener(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 12000));
listner.Start();
Byte[] bytes = new Byte[256];
String data = null;
while (true)
{
TcpClient client = listner.AcceptTcpClient();
Console.WriteLine("Подключился клиент");
data = null;
NetworkStream stream = client.GetStream();
stream.Read(bytes, 0, bytes.Length);
data = System.Text.Encoding.ASCII.GetString(bytes, 0, bytes.Length);
Console.WriteLine("Received: {0}", data);
client.Close();
}
}
public void SendMessage(string Message)
{
Message.Trim();
Byte[] data = System.Text.Encoding.ASCII.GetBytes(Message);
NetworkStream stream = client.GetStream();
stream.Write(data, 0, data.Length);
}
Как сделать, чтобы отправлялось сообщение клиенту, который прислал сообщение на сервер?