mardi 23 juin 2015

c# webserver working on local (127.0.0.1) but no on public

I used this webserver for c#.

I tried other projects too, but i can't connect to my ip.

This is the main function:

/// <param name="path">Directory path to serve.</param>
public SimpleHTTPServer(string path)
{
    //get an empty port
    TcpListener l = new TcpListener(IPAddress.Loopback, 0);
    l.Start();
    int port = ((IPEndPoint)l.LocalEndpoint).Port;
    l.Stop();
    this.Initialize(path, port);
}

For example: 127.0.0.1 - working localhost - working 122.211.2.27 - not working

Aucun commentaire:

Enregistrer un commentaire