I need to connect and send data to Bluetooth from Action Script 3 (AS3)
if there is any idea I'll be glad for your help
Thanks in advance ,
Nice question!
Wiimotes connect/send data through bluetooth.
I had a quick look through the WiiFlashServer java source.
It uses a ServerSocket and it seems to send binary data to flash via
the Socket class.
You could either adapt some of that code to suit your needs, or build a Socket server in your language of choice and send the data to flash sockets.
HTH,
George
Related
I want to develop a application on Windows Phonw 8 that allows me to use the phone as a remote control for desktop. My application is runnning like this: the phone is a client that connects to a TCP/IP server, that is located on the PC. The client sends to server the data from accelerometer. I want to know how could i use this data to make my device something like a gamepad, to control a game. Is a way that i could do this? Could you give me some information, or what i need to study? Thanks a lot.
Well, you just answered your own question. If you make the TCP connection to the machine, you are free to send any data from the phone to the target computer. And if you wrote that game yourself, you can control it.
However, if you want to play any game with your phone, you will have to write your own windows driver and that is not something trivial.
Read more Touch, Input, and HID: Architecture and Driver Support
Even if I think it's not possible, I would be sure by asking this to you :
Is it possible to create a webapp (offline/online) to communicate with a machine using Modbus TCP/IP without an external server ?
Here is the point :
We sell machines, which send and receive informations using Modbus TCP/IP, and we would like to create a standalone webapp using pure HTML5 offline cache manifest features that could communicate with them without passing by an external server (except for the first time launch for receiving configurations and save them to localStorage).
I don't think these could be done, but I would be very happy if I'm wrong ;-)
I discovered TooTallNate using Node.js, and I have already used phpmodbus, but these need a server between the device (smartphone or desktop browser) and the machines.
So my question is : is it possible ? And if so, which Javascript library can I use if exists, or where can I find needed informations ?
Thanks in advance for your answer.
Best regards
It is not possible with JavaScript.
Because of security, JavaScript can not access to local resources (Ports, File etc..)
I'm currently working on a project where I want to control a microprocessor (Arduino) from a web page.
The microprocessor will not be connected physically to the computer.
What is the best protocol for communication? (My current choice is TCP).
What is the best way to serialize the objects to be sent? (My current choice is JSON).
The server side is written in NodeJs.
Since I'm new to this kind of development I would very much appreciate any input on the topic!
Without details about which arduino you plan on using and what shields you might employ to achieve the interface it is hard to make a definite statement.
I would argue that with the proper shield to provide the ethernet interface TCP would be an acceptable choice.
I am inclined to say you are going to be hard pressed to build a JSON interpreter that fits into the memory foot print of an Arudino. Most of these devices have 32K of program memory, and 1 or 2K of data memory. For embedded devices like this a concise binary protocol on the wire is far more common and easier to fit into the device's limitations.
There is a library called aJson which allows you to do JSON parsing in Arduino. I have used that library to parse response from a YQL call all inside the 32K program memory of Arduino :)
I would suggest using Ethernet or Wifi shield for Arduino to make it connect to internet and then you can use the Ethernet library of Arduino to make HTTP calls. The response format could be in JSON.
Since i'm creating a stress tester for an FMS load balancer, i'd need to publish as many stream as i can , to see if the system will hold the load.
There's any way to send a local flv file through the NetStream.publish method?
After a little research, i found only the appendBytes solution, but it seems is not working.
Anyone has an example for this? or maybe a solution on how to fake a webcam so to send some bit of data.
Thank you all in advance.
Not sure if this will help you, but you could call functions on the server and pass large byte arrays (files, strings, whatever) as parameters.
Of course, this does not really count as a stream, but will put load on your server.
netConnection.call("functionName", responder(may be null), largeData)
What is a good framework to build a multiplayer game in Actionscript?
I want to create a multiplayer 2D shooter like Asteroids on the Blackberry Playbook; my main concern is latency - a shooter wouldn't be fun if the bullets are super-jerky and unexpectedly hit people.
I'm guessing that a UDP-based framework would be the best. Can anyone point me to the right direction?
There are many things you can use off the shelf but the basic setup is very simple but you have a few options.
The most common is server push, things like Flash Media Server, LiveCycle Data Services from Adobe or other tools like SmartFoxServer can do this. With this setup the server saves the connections to everyone that connects to the server and passes or "pushes" applications state to the people connected every time the data changes in the application.
Another option is called long pulling, this can be done with any web server really. How this works is the data stores the state of the application, when the application starts it calls the server, when it responds the client calls the server again.
There are a few other ways to do it but these are the most common. But this has nothing to do with protocol like HTTP, UDP, AMF, XMPP, or whatever else. The protocol is the format that the data is sent. With these out of the box servers they normally output a few of these but the fastest formats are binary like AMF but not always the best, there are advantages to each, because each gives you different features for keeping track of things.
If you are talking about have a game that takes over the world that has millions of users then you need to think about scaling and what happens when you need two or 100 servers and how do they talk to each other. But for now keep in mind that the more the server does the slower it will get, if you are sending small amounts of data it will be able to handle more users. Stick with making one efficient server and worry about that later if you get there.
You also need to thing about what server side programming language you want to mess with if any. Some services don't let you do anything, these normally cost money and don't do as much. Adobe likes Java but there are servers that output all of these protocols in most every language. My favorit lately has been Node.js a super fast way to run JavaScript on the server. Node.js has a built in HTTP server but it is just as easy to create a simple server that sends basic text through a Socket or XMLSocket. A server like this will easily handle many thousands of users. There are many games that use Socket.IO and if you want to see a simple example of what I'm talking about you can check out this.
Assuming you want to use Flash/Flex and not Java (Blackberry/Android) or native SDKs for Playbook -
There is a book as an inspiration: http://www.packtpub.com/flash-10-multiplayer-game-essentials/book it uses Pulse SDK at the server side. But you could use an own sockets-program on the server side. I use Perl as TCP-sockets server (sends gzipped XML around) in a small card game but this wouldn't work for your shooter.
Flash does not support UDP out of the box
But there is peer-to-peer networking protocol RTMFP in the upcoming Flash Media Server Enterprise 4 (price is out of reach for mere mortals)
So your best bet is to buy an Amazon-service for RTMFP then you can pay-per-use and stay scalable...
You can either do a constant post/get request with the server to get data for the game, but for a multiplayer shooter i'd surgest SmartFoxServer: http://www.smartfoxserver.com/
Out of the box, Adobe AIR supports UDP through datagram packets.
http://help.adobe.com/en_US/air/reference/html/flash/net/DatagramSocket.html
I couldn't find a particular networking API for flash, but perhaps you can build one. Libgren is open source and you can use that for reference.
You can also look into RTMFP though it's focus is on transmitting audio/video and some messages (through TCP I think).