ID:156861
 
I'm familiar with client/topic and sending data from within the worlds embedded browser. I'm also familiar with sending data to world/topic as a stream from an external application.

I was hoping for an easy solution that lets the user click a button on a webpage in Firefox which then sends some kind of "byond://" message to the client or server.

Is this possible? I'm a little rusty so I may have forgotten the obvious.
ts
I think you can using Dantom's CGI, but im not sure about that library myself...gives me headaches
The raw format that Byond expects has been posted a few times by various people. One of which I know was a post using PHP in a web page to send a message to a Byond world, I think the post might have been made by Crispy though I don't remember for sure.

If you can find one of those posts using the forum search, that will answer your question. Or you could just create an application to dump the data for you. Here's one example, using Java.
import java.net.*;
public class SocketDump
{
public static void main(String[] args)
{
try
{
Socket s = new ServerSocket(12345).accept();
int i = 0;
while((i = s.read()) >= 0)
System.out.print(", " + i);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}

I think that should do it. You could compile that in Java, run it, then from a Byond game export to "localhost:12345" (assuming both applications are on the same computer, obviously) and look at the data. This way you could figure out how the wheel works once again if you can't find any of those old posts I mentioned.
In response to Loduwijk
I've played around with this before and actually have a working implementation using a managed C# app. It works ok but I don't think its a great client side solution. It requires an install of a framework and the untrusted application. Not to mention the inconsistent behavior when streaming the data. I find that BYOND doesn't get the data over half the time.

I can't figure out why it is so inconsistent either. Any ideas on how to improve that without sending an acknowledgment back?

ts



id:394116 and [link].

In response to Loduwijk
I think I may have solved the inconsistency problem. Looks as though I need to slow down the rate of byte writes. By adding sleeps between each write, the data is 10 for 10 so far. I haven't tried to reduce this initial "sleep" test yet. I may find that I really only need one sleep but at a specific location. Working on that now.

bw.Write((byte)0);
Thread.Sleep(100);
bw.Write((byte)0x83);
Thread.Sleep(100);
bw.Write((byte)(length >> 8));
Thread.Sleep(100);
bw.Write((byte)(length & 0xFF));
Thread.Sleep(100);
bw.Write((byte)0);
etc...


ts
In response to Tsfreaks
Looks like the key sleep is needed toward the end and it seems to be working well with a 1/100th millisecond sleep.

...
bw.Write(msgbytes);
bw.Write((byte)0);
Thread.Sleep(10);
bw.Close();


ts