Comments (5)
There's a difference between your public IP and your machines local IP. You found the core issue, you would like to host your server on an IP behind a NAT device, which provides the machine with a local IP. The server starts up with it's local IP. However, the connect token has a reference to the public IP and the client must access the server on the public IP. The client and the connect token don't know anything about the server's local IP. So the security check fails since there's no matching IP between server local and the connect token list.
I think we can support this use-case with a small addition to the server's API. We can add an optional setting to the server, where it will know it's own public IP despite starting up with a local IP. You would have to provide the server with the public IP yourself, it will not have a way to find it on its own.
I do want to point out though, this is not a great solution for games today in terms of shipping. Requiring port-forwarding is outdated. Instead, by hosting your server on the cloud with a public IP none of this workaround is necessary at all, and no port-forwarding is required. I would encourage users to try out port-forwarding for testing and development, but not for releasing a game.
@Siltnamis Do you think this server API addition would work for you?
from cute_headers.
try to use '0.0.0.0:port' to bind the server address
from cute_headers.
does not work. it calls cn_endpoint_equals(server_endpoint, token.endpoints[i])
. And token endpoint contains "publicip:port" while server endpoint is "0.0.0.0:port" and ignores this connection attempt.
So my understanding is that server thinks that this connection is not meant for it. If I skip this check and assume that it matches - everything appears to work just fine.
from cute_headers.
Yes it would be useful for me. I'm far away from shipping anything so it is just easier to host on my local dev machine and let a friend join and tryout the game outside LAN.
Thank you for explanation :)
from cute_headers.
Verified this working with my own router + port forwarding. You can now call cn_server_set_public_ip
for development and testing.
from cute_headers.
Related Issues (20)
- [cute_sound.h v2.x] Support multiple contexts. HOT 2
- http://randygaul.net is taken over by squatters HOT 1
- Dynamically set panning for an individual playing sound HOT 2
- cute_aseprite.h - v1.3 Tilesets Discussion HOT 4
- cute_aseprite.h - Aseprite v1.3 property map support
- Cute_tiled "staggered" causes warning HOT 1
- inclusion of infinite maps and chunks HOT 3
- c2TOI returning wrong contact point
- cute_tls - allow ignoring certificate errors HOT 1
- cute_tiled: Force loading RGBA for tintedcolor
- cute_tiled: object `type` field HOT 4
- cute_2d c2PolytoPolyManifold issue HOT 2
- [Cute_Net.h] Knowing if a packet has been sent. HOT 3
- [cute_tiled_h]: Field `name` points to wrong memory address. HOT 2
- cute_aseprite.h "warning C4456: declaration of 'frame' hides previous local declaration"
- Usage of c2x and rotation HOT 1
- cute_aseprite.h crash with both 9-slice and pivot enabled. HOT 1
- cute_sound 2.x has no equivalent of 1.x cs_stop_sound
- cute_aseprite Crash on tags user data HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cute_headers.