none
Newbie seeking assistance, trying to make an online LDServer

    Question

  • Hi guys, I'm using the litdev library to make a server accessible from the net, using the example that came with the library.

    I just can't seem to be able to set the server to my online address, it doesn't accept it.

    First I tried this:

    1)'Start the server and output the connection string to a file

    2)LDServer.ip="89.210.139.211"

    3)server = LDServer.Start("True")

    4)File.WriteLine(Program.Directory+"\server.txt",1,server)

    and the textwindow returns: LDServer.Start : The requested address is not valid in its context

    afterwards, i tried the program in this order

    1)'Start the server and output the connection string to a file

    2)server = LDServer.Start("True")

    3)LDServer.ip="89.210.189.211"

    4)File.WriteLine(Program.Directory+"\server.txt",1,server)

    and it does not return an error, but when I check the log it creates with the ip in it, it returns my local host

    how can I get it to properly accept my public ip so I can connect to it from another location via the internet ?


    • Edited by Lord_Archon Tuesday, April 18, 2017 3:03 PM mistake
    Tuesday, April 18, 2017 2:13 AM

Answers

  • I think I got it working without too much work.

    The steps I took are:

    1] Run the LDServer as normal on server host PC using default internal IP and host, for me this is 192.168.1.244:100

    server = LDServer.Start("True")
    TextWindow.WriteLine(server)
    LDServer.ClientConnected = OnClientConnected
    
    Sub OnClientConnected
      TextWindow.WriteLine(LDServer.LastClientConnected)
    EndSub

    2] Set up port forwarding on your router to pass port 100 from external to internal.  The internal is your home network PC IP as in step 1.  The external is what will come in from the web.

    3] Find your current external web IP, from for example http://whatismyipaddress.com/, eg XX.XX.XX.XX

    4] I had to disable PC firewall (running windows 10), but there should be some inbound rule you can set to allow port 100 to be used by your server exe in some way.

    5] On some other web PC start the client using the external web IP and port 100

    result = LDClient.Connect("XX.XX.XX.XX:100","True")
    TextWindow.WriteLine(result)

    I only tested on my local PC, but using the web nework IP only works if the router and firewall are set so it is certainly going through these I think.

    Setting the router port forwarding will depend on your router and ISP.  Also note that both internal and external web addresses my change when router resets or PC makes a connection to home network.

    Hope this helps.

    PS

    For the firewall - "Allow and app or feature through windows firewall" (and choose the server.exe created by running SB server.sb) does it for me.

    Wednesday, April 19, 2017 9:32 PM
    Moderator

All replies

  • The server program (Small Basic program) must be running on the server machine.  Therefore you will probably need to set your PC up as a network server to host a server client application using these methods.

    When you do LDServer.Start without having set LDServer.ip, then the local PC (where the server program is running) is set up as the server - should be the default in most cases.

    The IT required to set your PC us as a web server is not too bad, but also not trivial, with potential security problems and beyond the scope of this forum.

    I would suggest creating a server client program initially on a home network, then perhaps open up your PC to the web as a server if you really want to go this way after understanding the implications and additional software to do this.  To be a server on the web, someone outside your home network should be able to access your PC directly though IP:Port.

    If 89.210.139.211 is your local PC address on the web (test by hosting a simple html file that you can access from web at this address), then it should work and maybe there is some other issue?

    Tuesday, April 18, 2017 3:56 PM
    Moderator
  • Very interesting. Would you suggest using hamachi to make this easier ? Then I could set up the server/client to use localhost over the internet since hamachi makes it appear as if you are in the same lan ?

    edit:i managed to make a server using the ipv4 of the private network i created with hamachi. no localhost needed, just set the ip to the vpn ip. ill have to test it out more with multiple computers in different places to be 100% sure but i think it works

    • Edited by Lord_Archon Tuesday, April 18, 2017 5:18 PM
    Tuesday, April 18, 2017 4:09 PM
  • I can't really recommend hamachi or not since I nver used it.  It looks an interesting possibility though - if you try it and it works please let us know.

    On a previous PC I did play a little with creating a small web server, I used WAMP and IIS and DynDNS to get a web name.  I never really used it though for anything other than playing.  As long as you are careful and follow the online instructions exactly (reading and understanding before you do it) it could be fun to try.  Read plenty about it, problems people have etc first.

    Another possibility is to write some php on a server hosted by some commercial (some are free) webserver.  This can handle some simple web requests - not a proper client server though (I use this for some LDNetwork methods).

    Tuesday, April 18, 2017 5:46 PM
    Moderator
  • I think I got it working without too much work.

    The steps I took are:

    1] Run the LDServer as normal on server host PC using default internal IP and host, for me this is 192.168.1.244:100

    server = LDServer.Start("True")
    TextWindow.WriteLine(server)
    LDServer.ClientConnected = OnClientConnected
    
    Sub OnClientConnected
      TextWindow.WriteLine(LDServer.LastClientConnected)
    EndSub

    2] Set up port forwarding on your router to pass port 100 from external to internal.  The internal is your home network PC IP as in step 1.  The external is what will come in from the web.

    3] Find your current external web IP, from for example http://whatismyipaddress.com/, eg XX.XX.XX.XX

    4] I had to disable PC firewall (running windows 10), but there should be some inbound rule you can set to allow port 100 to be used by your server exe in some way.

    5] On some other web PC start the client using the external web IP and port 100

    result = LDClient.Connect("XX.XX.XX.XX:100","True")
    TextWindow.WriteLine(result)

    I only tested on my local PC, but using the web nework IP only works if the router and firewall are set so it is certainly going through these I think.

    Setting the router port forwarding will depend on your router and ISP.  Also note that both internal and external web addresses my change when router resets or PC makes a connection to home network.

    Hope this helps.

    PS

    For the firewall - "Allow and app or feature through windows firewall" (and choose the server.exe created by running SB server.sb) does it for me.

    Wednesday, April 19, 2017 9:32 PM
    Moderator