Hi folks,

I have an app that will connect to a server.

My connect method looks a bit like this:

private void connect(IPEndPoint ipEnd)
        {
            try
            {
                m_clientSocket.Connect(ipEnd);
            }
            catch
            {
                connect(ipEnd);
            }
        }

Now, if I run this, my application can't let the user still use it as it's stuck in this loop. So I tried putting the whole network class in a different thread. However, when I start the server, the client machine will bring up an error saying that the I/O opeartion has stoped due to a Thread exit or application request...

Any Ideas?

Thanks

Use these methods of TcpClient class - Connected , LingerState appropriately.

I hope you get it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.