Jump to content

c_connect() question

Recommended Posts

Hey, I had a quick question for @PeterA or @MarkL. I wouldn't bother you if this wasn't something worthwhile, but I have a question about c_connect(). We are trying to connect via our real/public IP address (we are in the same house right now. Also, we haven't changed any port numbers, it's just 10999 like default). I look it up through https://whatismyipaddress.com/ and he types it in. During our testing, we tried to change up the IP address using our phone's hotspots, but the only successful variation of this would be if I (the host) was connected to the home wifi and he was connected to the phone hotspot. Never the other way around or with two phone hotspots. VPNs also would not work if I used one, however he was able to connect if he used one.

My question is if there are certain requirements or limits to this c_connect() command. Any description of how it works internally would be useful to know too.

Link to comment
Share on other sites

MarkL works on Hot Lava last I knew.

From consolecommands.lua:

-- Work in progress direct connect code.
-- Currently, to join an online server you must authenticate first.
-- In the future this authentication will be taken care of for you.
function c_connect(ip, port, password)
    if not InGamePlay() and TheNet:StartClient(ip, port, 0, password) then
        return true
    return false

I'd presume that the ip must be ipv4 and not ipv6.

The limits of your network would be proper passthrough to allow incoming traffic onto your computer through your phone device.

This service can help at: https://canyouseeme.org/

  • Like 1
Link to comment
Share on other sites

I don't think there's much behind c_connect - it just tries to establish a game session on that address, and that's it. When it doesn't work, it's down to network setup (topology, NAT/firewall rules, etc.)

A few guesses from me:

  • When you're both on the same NATted network, and want to connect via public address, your router must be set up with hairpin routing. I don't think many home routers do this, especially for UDP.
  • Unable to connect to server on mobile internet - unsurprising, the normal mobile data plans are more restrictive than wired home connections. ISPs often lock the "incoming connection/server"  feature behind some paywall (business data plan, public IP surcharge, etc.)


Steam, and by extension DST, don't support IPv6 (with the exception of downloads). Please pester Valve to get their act together, here.

Out of curiosity, why insist on connecting manually via the public address? For me event the global server browser was often flakey with servers on the same subnet, but switching to LAN browser fixed this.

  • Like 1
Link to comment
Share on other sites

@myxal well we’re using c_connect as a workaround for a mod that forces people to disconnect... And admittedly, our phones are a little simple, we just needed a new IP address. I guess it just boils down this: what kind of connection is the minimum before connecting doesn’t work.  The weird thing, though, was that it always worked when we looked on the server list, just not when we used c_connect. This is what led me to believe there was something else behind it...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...