Go Down

Topic: Ethernet Serial Proxy and Flash (Read 2 times) previous topic - next topic

Adam_Ray

Hi,

Is anyone working with Arduino via Ethernet via Flash? I am so close to getting it working but an being stopped by flash requesting a cross domain policy file.
:-[
Is there anyone out there working on something similar?

Adam

admin

this should happen only if you have the arduino connected to a machine and the flash files server from another.
This triggers the request usually. there is a way to run a policy file server.

this should be useful

http://www.adobe.com/devnet/flashplayer/articles/socket_policy_files.html


if the arduino is connected to the same computer that's serving the swf files then there is something wrong with your configuration

m





Adam_Ray

Thank you Massimo.

Am I right in thinking that Flash connected to the Arduino via the net is a new era?  :o

Adam

PlastBox

Sorry mate, no matter how cool controlling the Arduino form a slick webinterface is, nothing Flash-related is "a new era"! Every proffessional webdeveloper I know (including myself) loathe Flash for it's plugin-dependancy, slowness and the fact that only a very, very few people out there use Flash moderately and skillfully enough to actually make it remotely useful. ;)

If you want a smooth webinterface, check out AJAX. Or.. since AJAX is "Asynchronous JavaScript and XML" it's kind of limiting. Check out javascript and XMLHttpRequest. Combine it with css (and if you wish php and a mysql-database) and do it well, and you have a slick-looking interface that works in virtually any browser on any system made after 1990. Including cellphones which I think is a much cooler application of having a webinterface than controlling stuff from your computer only.

On the topic, I'll finally be getting my internett-hookup tomorrow and I recently managed to get my computer make the Arduino send NEC ir-remote signals to control my tv. I'm going to add the codes for my dvd-player, and also a few hardware devices like lightbars, lamps, etc. It will be awesome! 8-)
Dreaming of extra senses through sensory substitution/agumentation since.. well, for ever.. =P
Going to automate my home, just gotta find the perfect DIY solution first!

Adam_Ray

Hello PlastBox,

Apologies, unfortunately I am not a professional web developer so I am unable to compete with your exposure to flash and web development. However, I have had very little difficulty in connecting flash with Arduino over the net. I think that this gives hope to us unpaid passionate novices  :).

The reference to a "new era" was simply a question as to has anyone connected to the Arduino via flash over the net? Don't worry I'm not placing the Adam flag I was merely curious and hoped for a response. I feel this is an achievement of the Arduino community which should be celebrated as apposed to an objection of Flash and Arduino.

I understand and use AJAX (I thought that AJAX is JavaScript and the XMLHttpRequest object?) however, due to its lack and the lack of any other web technology to analyse sound dynamically in the browser I have had to resort to Flash. I understand Java will work however my lack of skills leaves me with only one other choice: Flash.

I understand that controlling Arduino via mobile is cool, however I feel satisfied connecting to the Arduino from any computer in the world.

Oh, another note, its: "internet" as apposed to "internett", you professional web developers crack me up  ;)

Good look with your work

Adam

PlastBox

Oh god, sorry about the nett/net thing. I am norwegian and apparently my brain found it fitting to insert a norwegian word into my otherwise fairly decent english post. :-? It is fairly decently written, right? I haven't been in school for a good few years so.. ehe ::)

What tools you use of course depends on what you want to do, and I don't personally have much against Flash. It's more just me getting tired of seeing people missuse flash to make sites that are heavy to load, slow to run or don't really work good at all. =P

I tend to sometimes go a tiny bit overboard when sharing my opinions. Like when discussing Java with Prophets of Javas Ultimate Coolness.. Sure, Java can be a great tool but I still end up quoting "Saying that Java is great because it works on all operating systems is like saying an*l s*x is great because it works on all genders." =P Hehe
Dreaming of extra senses through sensory substitution/agumentation since.. well, for ever.. =P
Going to automate my home, just gotta find the perfect DIY solution first!

toti16

Hi, I ralize this thread is form almost a year ago, but I'm trying to controll my Arduino from the Internet through Flash and Serial Proxy. I allready have my arduino communicating with flash just fine. However, I tried running the flash on an HTTP server running on my computer, and serproxy also running in my computer, hoping that flash would still be able to communicate with serproxy. But it doesn't work, on the first post of this thread, you said you almost had it working, can you please tel me how you did this.

Thank you.

toti16

UPDATE:

I'm almos able to make it work, I can now see my flash application from another computer and the serproxy running on my computer actually starts, however it ends quickly with the following message:

server(1) - thread started
server(1) - EOF from sock
server(1) exiting

I've looked for that "EOF from sock" everywhere but can't find what it means.

PlastBox

Hey

EOF means End of File. What you usually do when reading from a file is read "until EOF(1)" which means you read until End of File == True.

Reading from a network socket is (in most languages) very much like reading from a file. A packet is often terminated with the same character as a file (ascii character 0) so when you read a socket you can read until EOF(1).

I'm guessing you do something like this for your main loop:
Code: [Select]

while(!EOF($connection))
{
     //read incoming data
}


The above is all well and good, except that it seems either serproxy or your flash application ends each packet with the ascii character 0 which means, to your program, EOF is true and thus the loop is exited.

I have very little experience with serproxy myself, as the version I tried opened the serial connection every time a network connection (like from your flash app) was created, and closed it when the network connection was closed. This meant that Arduino restarted, complete with the 5 second bootloader delay, every time I needed to connect.

Ok, that was way more than I was planning to write, but if I were you I'd check to see if serproxy keeps the serial connection open at all times. Try to write a simple arduino sketch that simply returns any serial data it recieves, fire up serproxy and connect to it with telnet. If everything works you should see whatever you type echoing back to you from the arduino, via serproxy. If this works, you need to see if your flash application sends character 0 after each package.

Ah, also.. I seem to remeber something about serproxy (for linux) having different parameters with regards to network behaviour. Do a "serproxy --help" to see what the parameter for changing network behaviour is. I don't remember properly, sorry, but I know there is something there to make it just pass everything right through (including character 0).

Good luck! :D
Dreaming of extra senses through sensory substitution/agumentation since.. well, for ever.. =P
Going to automate my home, just gotta find the perfect DIY solution first!

toti16

Thanks for your reply , I'm going to check that tomorrow and see if there is something I can change on the serproxy config.

Here is what is strange though, if I run serproxy on my computer, and I run my flash app on a different computer and open a socket from flash to serproxy it actually works! I can communicate over the network with the arduino. However, if I place my flash app on a webserver on the same computer as the arduino and then access the webpage from another computer, thats when the EOF thing appears. I wonder if it has anything to do with being running two webservers at the same time, though they are on different ports.
The reason I want to do this is so that I can control my arduino from a webpage on my LAN, and after that over the internet.


Go Up