Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

Which Ports is the game using?

Discussion in 'Multiplayer' started by g4borg, Jan 17, 2014.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. g4borg Apprentice Engineer

    Messages:
    271
    Anybody knows? For portforwarding reasons and such.
     
  2. Barrio575 Apprentice Engineer

    Messages:
    290
    I searched but came up with nada.
     
  3. K^2 Apprentice Engineer

    Messages:
    174
    Doesn't seem to be needed. I was able to host without setting up port forwarding.
     
  4. g4borg Apprentice Engineer

    Messages:
    271
    Definitely needed. You have probably a router which has some kind of UPnP.
     
  5. K^2 Apprentice Engineer

    Messages:
    174
    If this router has UPnP support, that'd make SE the first game that'd ever manage to get it to work. Why are you so certain that port-forwarding is required?
     
  6. MOFO_Pisatel Trainee Engineer

    Messages:
    6
    Maybe tech support team can post a small guide which ports need to be open and how to run a server which people can join (due to the infinite "joining world" bug)
     
  7. g4borg Apprentice Engineer

    Messages:
    271
    a) because all my friends who have nat/router setups cannot serve a joinable server, except they port forward the router; we used a broad range to catch the game which is only possible if you are the only one behind the router atm.

    b) i am quite a seasoned programmer and did a lot of networking stuff, so i know you need an accessible server to connect to for networking; i also know the different magic workarounds, upnp being easily accessible in c# solutions; was just a guess.

    unfortunately c) i am not an IT expert in windows, and the netstat command didnt show the listening port. :/ unfortunately the netstat in windows is not very versatile.

    and yeah mofo, lets hope so. was just curious if someone found it out over night :p
     
  8. K^2 Apprentice Engineer

    Messages:
    174
    Then you should be aware that NAT for UDP works differently, and so long as you have a name server, you can make a connection without port-forwarding through many routers.

    I'm not saying that this is necessarily the case, but I am saying that there are definitely ways to make a server work without having to forward ports.

    And forwarding a broad range of both TCP and UDP ports can still help if the particular router doesn't handle UDP NAT very well.

    I guess I'll go and try to catch the connection with wireshark, or something.
     
  9. Thalion Apprentice Engineer

    Messages:
    255
    I don't exactly know this either, but this MP maybe depends much on steam. Steam has UDP ports or can be forced to TCP with -tcp . Mapping those ports in Steam might help to get this MP more stable. I haven't tested it yet, are able to confirm or deny this assumption.
     
  10. g4borg Apprentice Engineer

    Messages:
    271
    There are ways, of course, especially since ipv6. But none of them works for every internet setup.

    UDP and TCP may work differently in many ways, which i am aware of, but i have to tell you, your information is per se incorrect. you still need a direct connection in UDP. there is simply no difference there. At least, most routers will filter unknown udp the same as tcp. Our firewall definitely will.

    Of course it could be ipv6, too. and there are many ways to make it work, without having to forward ports, especially if there is a helping system like steam, to create a client based connection over some relay.

    Fact is, it works if you forward ports, but it isnt very healthy if you don't know which.

    And instead of smarta$$ing, lets just hope this info bubbles to the surface, coz i guess there are more people needing this.
     
  11. extraammo Senior Engineer

    Messages:
    1,015
    I heard it uses Steam's system which tries to setup direct connection between players and uses a steam relay center if it cant.
     
  12. K^2 Apprentice Engineer

    Messages:
    174
    Router doesn't filter anything. It just needs to know where to send incoming packets, and if you don't have port-forwarding, it has to have another means of doing so.

    If you open up a TCP connection to, say, a web server somewhere. It's not a problem. When you send the sync packet to the server, your router notes the destination IP and the sequence numbers. When the server replies, router knows where to send the reply packet, because it knows who initiated this particular connection. So you don't have to forward any ports if you are planning to connect to a remote server.

    Naturally, if you are the server, the router does not know where to send the sync packet from a remote client if the port isn't forwarded, and you end up with no connection.

    This doesn't work with UDP packets. There is no such thing as persistent UDP connection. Yet, if you send out a ping to a remote server, you will receive a ping back. How does the router know whom to send the ping reply to on the LAN? Well, it still knows the destination address, so it simply checks if anyone sent a UDP packet recently on the same port, and just assumes that it should send the reply to the same person.


    Why is this relevant to gaming? Suppose, I wrote my game to work with UDP packets. It's a bit of extra work, if you want to make sure packets aren't getting lost or arrive out of order, but it can be worth it in terms of performance if your code is well-written. So we still have server and clients, but there is no TCP connection to establish. Suppose, a client wants to connect to a server I'm running. Naturally, if he just sends a join-request to me, the router won't know where to forward it on the LAN, and he won't be able to connect. But lets say that we are also both connected to a name server. Like Steam, for example. And suppose that Steam can notify my server code that a user at some IP address is trying to connect to me. Well, if that's the case, my server code will send out a UDP packet to that client.

    Here is the cool part. Client may also be behind the router. And the packet the server sends might not reach the client. But that doesn't matter. Like the content of this first UDP packet doesn't matter. All I need is to establish a precedent for my router. It now knows that a packet has been sent to client's address on the specific port. So when the client tries to join immediately after, his UDP packet is going to be forwarded to my server, because router's NAT treats it as a reply to my earlier packet.

    The advantage is that this method requires no port-forwarding. The disadvantage is that a whole lot of things can go wrong. Some routers have rather arbitrary windows on reply time. Some might only allow this on certain ports. Some might have some other weird restrictions. You can also mess up the timing when getting connection attempt notification from your name server.

    So we arrive at a system that does not strictly rely on port-forwarding, but which can run way more stable if ports are forwarded. Does that sound like the sort of thing that's happening with Space Engineers? Because it does to me.
     
  13. extraammo Senior Engineer

    Messages:
    1,015
    https://support.steampowered.com/kb_article.php?ref=8571-GLVN-8711
     
  14. K^2 Apprentice Engineer

    Messages:
    174
    Yeah, I'm seeing the traffic to Steam, but besides that, there is direct connection to individual clients. I ran WireShark on several games, and I can identify Space Engineers traffic and clients that are connecting to my server, but the ports are different for each connection and each client.

    They are UDP packets, and they do seem to fall in the 48k-64k range, which can probably help people narrow down the range they have to port-forward, but that's still a huge range.
     
  15. davesoft Apprentice Engineer

    Messages:
    168
    Looks like port 80 to me, with some high end port traffic, probably for synchronising clients together.
     
  16. DarkGhost Junior Engineer

    Messages:
    765
    Port 80 is reserved to HTTP, using it for something else is deadly, unsecured and useless.
     
  17. K^2 Apprentice Engineer

    Messages:
    174
    Nah. It's definitely the UDP traffic in 48k-64k ranges. It only shows up with the server running, new IPs showing up match new clients connecting, which also agrees with additional messages being passed to and from the Steam server, and so on. The only bit I don't get is why ports are random. Might be a standard feature for using Steam as a name server. I'll see if I can find some documentation on that.
     
  18. g4borg Apprentice Engineer

    Messages:
    271
    Explains a lot why I can't see it in netstat. So it does use steam for network - also to punch a hole from the client over a relay - well theoretically if that works correctly, port forwarding should indeed not be needed - as long as this really works.

    So probably it's just small bugs.

    Very well then. Thx for the efforts.
     
  19. davesoft Apprentice Engineer

    Messages:
    168
    Go learn communications. HTTP is a super useful protocol, intarwebs or not.
     
  20. K^2 Apprentice Engineer

    Messages:
    174
    Only for punching through NAT. From there on, all communication is directly server to client.

    And yeah, if opening up a broad range helps in some cases, there are definitely still bugs to be worked out.

    Please, re-read the post you are replying to carefully.
     
Thread Status:
This last post in this thread was made more than 31 days old.