How can i access my server with a external ip?

i want to access my website with a external ip but it’s dosen’t work
here’s the code

Server myServer;
PrintWriter output;
int nb = 0;

void setup() {
  size(200, 200);
  // Starts a myServer on port 5204
  myServer = new Server(this, 80);
  println("ip: " + Server.ip() + ":80");

void draw() {
  Client client = myServer.available();
  if(client != null)
    String information = client.readString();
    output = createWriter(sketchPath("data/lol" + nb + ".txt"));
    client.write("HTTP/1.1 200 OK\r\n");
    client.write("Content-Length: 124\r\n");
    client.write("Content-Type: text/html\r\n\r\n");
    if(match(information,"GET / ")!=null)
      client.write("<html><head><title>ca marche</title></head><body><h2>coucou</h2><img src='' alt='Tux'></body></html>");
    else if(match(information,"GET /favicon.ico ")!=null)
      client.write("<html><head><title>ca marche</title></head><body><h2>coucou t un probleme, mon probleme, je ne trouve pas ta page :(</h2><img src='' alt='Tux'></body></html>");

what you have is a webserver on your ?PC? what can be called with its local IP from within the network

if you want to call that webserver from the “outside” internet

  • -a- you need to know the IP of your home router( browser check my ip )

  • -b- when you then contact your router from outside it must know that you want to talk to the local PC with the local IP you see from the processing.

    • -b1- well there can only be one server in your network ( on port 80 why you changed that, pls go back to use old port again )
    • -b2- in the router configure a port forward to the local ip of your server (PC). if use port other then 80 pls configure that there too.
    • -b3- and now need lots of luck that your ISP allow that, (any server from your home / they might want sell you fix ip service… )
  • -c- testing can be difficult , so its good to be “outside” like with some free internet tools ( VPN and proxy service ) so you can call back your home, because also your router might not allow to talk from inside via outside to inside …

1 Like

idk what i do but it’s work :smiley: