简体   繁体   中英

Connecting to Python Server via C# Client

I/we've got a tiny problem here. We are trying to connect to a server, written in python, with a client, written in C#, via TCP connection.

I'm capable of connecting to Port 80, but to none else. Is there any big mistake we are looking at? Furthermore we tried running the server (python) on a usual PC as well as on a webspace.

        static void Main(string[] args)
    {
        TcpClient socket = new TcpClient();
        socket.Connect("<my ip here>", 8585);

        if(socket.Connected)
        {
            Console.WriteLine("connected!");
        }
        else
        {
            Console.WriteLine("connection failed!");
        }

        Console.ReadLine();
    }

Server: Click here

Can you also ping the webspace including port 8686 like http://localhost:8686 ?

Maybe the webspace provider is blocking port 8686.

Try to bind the port of the python server to port 80.

Update :

When the webspace does not allow binding to port 80, then try to make it open port 8686 or change the provider:)

You can still try it on localhost.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM