ID:228614
 
(See the best response by Ocean King.)
Is it possible to send messages from a hosted server, or even from a local game to another local game provided that the address is known? I have been trying to do this, but with no success. I have succeeded in having a local game send messages to a hosted server and had hosted servers communicate between one another but I can't get a hosted server to message a local game.

I am trying to design a system where there is a central server that serves save files to multiple games, whether hosted or local. I haven't moved to actual moving of save files as yet, i'm using Export to just share messages between worlds to be able to test that the communication is occurring.

Idea of implementation
1. Game server is hosted and alerts the central server of it's existence.
2. Central server keeps a record of the address of the game server.
3. When something is said in a game server, it is sent to the central server and printed to current world.
4. Central server cycles through all recorded addresses and mails out the message to all excluding the original and prints to central's world.
5. Game servers receive message and print to their worlds.

Hosted servers function perfectly, local games do not.
Central Server: http://www.byond.com/games/ChrisGayle/SpiritAge
If by "local game" you mean a game that is not Hosted (as opposed to another hosted game on the same computer as the first computer), then no, it is not possible to use Export in that way.


Unless you used a DLL, of course. Or hell, sending a HTTP request through JS.
That is a little disappointing.
How you're returning the data to the "client"?
Yes it is very possible as long as you know the address ..

Using world.Export and client/Command ... I believe.

Here is my really really old lib - http://www.byond.com/developer/ATHK/TelnetServerAdmin - it can be done via telnet or dreamseeker.
Best response
As far i know this works fine:

Central Server:
#define TEST_CONNECTION 0
#define CONNECTION_SUCCESSFULL 1

world/Topic(T) {
var/list/paramstolist = params2list(T);
if(paramstolist["action"] == TEST_CONNECTION) {
return list2params(list("action" = CONNECTION_SUCCESSFULL, "message"="Hello :3"));
}
}


Client:

#define IP ServerIP
#define TEST_CONNECTION 0
#define CONNECTION_SUCCESSFULL 1

proc/Connect() {
world.Export("[IP]?[list2params("action"=[TEST_CONNECTION])]");
}

world/Topic(T) {
var/list/paramstolist = params2list(T);
if(paramstolist["action"] == CONNECTION_SUCCESSFULL) {
world << paramstolist["message"];
}
}


if there's any type error tell me, i wrote it in the browser. lol
^ nice.