ID:265275
 
I'm redoing BYONDradio, and this team it's gonna stream to other games. I want to have a library that people can drop into their games and get BYONDradio... To export, I need to know the IP, and for Topic, I need to know the exporter's IP, so I can't have the other game export their IP and add it to the list. What do I do to add their IPs to a list without doing it manually. and, if you wish to post code, I would appreciate it being commented.
anyone? Ideas?
In response to Dragon of Ice
Having it stream to games is probably not the way I'd go about it.

The way I'd go about it is to have the *games* download from the main server at regular intervals, copying a chunk of data big enough to last them a couple intervals. The reasoning behind downloading enough for a couple intervals is so the client program doesn't just suddenly lose the "broadcast" when/if it doesn't manage to contact the server during an interval.

That way, the server doesn't need to keep track of anything, and the only thing that games have to know is where the main server is being hosted.
In response to Spuzzum
But wouldn't I still be using Export and Topic, and thus still have to know the client's IP to export the chunk of data?
In response to Dragon of Ice
Actually, it should be fairly easy to have the library contact the main server and register the game.

You'll want to use the fetchip() snippet shown in id:238339
in case they are hosting behind a router.

After that, you just export to your server's address with the information. Something like:

world.Export("serveraddress:serverport?action=register&world =[world.name]&waddress=[fetchip()]&wport=[world.port]")

Within Topic for your server, you'll need to check for incoming registrations. If the action is register, you then pull the rest of the info from the url. If you are unsure of how to do this, check the Topic() help. If you're still not clear, feel free to ask. I can step you through it =)

-<font color=#0000FF>Sapphiremagus</font>
In response to Dragon of Ice
Dragon of Ice wrote:
But wouldn't I still be using Export and Topic, and thus still have to know the client's IP to export the chunk of data?

Not quite: because the clients contact the server first, the clients inform the server what their current address is just by talking to the server. The server doesn't have to "know" anything, since every time it receives a communication it gets told all of the necessary data.

Servers love being told what to do without having to think about it. Just make sure you also tell the server to ignore bad communications or spammed download requests from the same address. =)


Clients do need to know the server's address, but if the server is on a static IP, that can be hard-coded. If the server's on a dynamic IP, you'd be better off using something like dynehost.com and setting up IP forwarding through them.
In response to sapphiremagus
I may take you up on that help once I get my PC on the internet so I can test out the code I've got so far.