K
K
kinvekt2015-10-01 18:32:52
C++ / C#
kinvekt, 2015-10-01 18:32:52

Global ip for server in c#?

I understand with writing of the server on c#. Here is the beginning of the code.

// Определим нужное максимальное количество потоков
                // Пусть будет по 4 на каждый процессор
                int MaxThreadsCount = Environment.ProcessorCount * 4;
                Console.WriteLine(MaxThreadsCount.ToString());
                // Установим максимальное количество рабочих потоков
                ThreadPool.SetMaxThreads(MaxThreadsCount, MaxThreadsCount);
                // Установим минимальное количество рабочих потоков
                ThreadPool.SetMinThreads(2, 2);


                // Устанавливаем порт для TcpListener = 9595.
                Int32 port = 9595;
                IPAddress localAddr = IPAddress.Parse("127.0.0.1");
                int counter = 0;
                server = new TcpListener(localAddr, port);

                // Запускаем TcpListener и начинаем слушать клиентов.
                server.Start();

How to make the server recognize the global ip? If you connect via ip with 2ip, it gives an error.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ruslan Fedoseev, 2015-10-01
@kinvekt

IPAddress localAddr = IPAddress.Parse("0.0.0.0");
?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question