-2

i wrote a program that use TcpListener. when my app run with C# program, other app and other device can connect (from an other computer or other device) to my app and my TcpListener can listen and respond them. but when i build a setup.exe file from my app and install it, if other app is running on my computer, TcpListener can listen and respond, but if other app is running from an other computer, TcpListener can't listen. and also other device can't connect to my app.

please guide me to solve my problem. THANKS

    TcpListener TcpListener;
    private void Form1_Load(object sender, EventArgs e)
            {
                TcpListener = new TcpListener(IPAddress.Any, 4051);
                thread = new Thread(Connection);
                thread.Start();
            }
    
    public void Connection()//accept connection
            {
                while (true)
                {
                    TcpClient tcpClient= new TcpClient();
                    TcpListener.Start();
                    tcpClient = TcpListener.AcceptTcpClient();
                        thread = new Thread(() => ConnectionFromOut(tcpClient));
                    thread.Start();
                }
            }

1 Answers1

0

by setting windows firewall, i can solved this problem.