ActionScript socket in Android - android

I have a Flash client application, written in ActionScript, which uses the XMLSocket class to talk to the server device via TCP/IP, on port 5750. So for example, I can run the Flash client in a browser and connect to a server which is on the Internet.
Since recent versions of Android support Flash, I would expect this to work when we install the Flash client on an Android device. However, the connection attempt just hangs. I don't currently have any diagnostics on the client side, just the running Flash application. So we have no logs or standard error messages.
The server device is basically a black box, but it does seem clear that the server never gets the request from the client. This suggests that the client was unable to open the socket.
A basic Web search suggests that not much is known about this situation. Any thoughts about what's going wrong here?
For example, maybe XMLSocket just doesn't work in Android? Or Android blocks port 5750? Or Flash Player has some kind of sandbox or firewall limitations built in?
We've tried a couple of different Android devices running Android 2.2-2.3 and Android Flash Player 10-11. The client is written in ActionScript 2.

This is probably a security settings problem.
I suppose your Flash client running on the Android device is not in the same domain as the server. Adobe's AS2 reference tells it all:
The XMLSocket.connect() method can connect only to computers in the same domain where the SWF file resides. This restriction does not apply to SWF files running off a local disk. (This restriction is identical to the security rules for loadVariables(), XML.sendAndLoad(), and XML.load().) To connect to a server daemon running in a domain other than the one where the SWF resides, you can create a security policy file on the server that allows access from specific domains.
Setting up a server to communicate with the XMLSocket object can be challenging. If your application does not require real-time interactivity, use the loadVariables() function, or Flash HTTP-based XML server connectivity (XML.load(), XML.sendAndLoad(), XML.send()), instead of the XMLSocket class. To use the methods of the XMLSocket class, you must first use the constructor, new XMLSocket, to create an XMLSocket object.
There are a couple of other related problems to your question, worth taking a look:
XMLSocket working in firefox but not IE
Flash client XMLSocket not connecting to server

Related

.NET Web service (asmx) which is back end for Android devices does not serve devices from the same IP

Here is the deal... I have created a web service (asmx) which is running a long time consuming procedure in a class and returns the result. The web service is served in my local windows 10 IIS connected to the router with port forwarding. The android device connected to the same router (as the iis) accesses the web service in IIS with the outside IP (my router's IP on the internet - for checking purposes). I noticed that the first device accessing the service is served ok but the second delays big time to be served. Checking the net I found that there is a restriction in serving devices from the same IP. I disconnected one of the devices from the WLAN and everything worked as a charm. Both devices were served in the same time. How can I overcome this problem?
Thanks in advance
Searching the Internet I discovered (there are huge chances that I may be wrong) that this might have to do with the default behavior of DotNet framework which locks the session to the first in first served device:
ASP.NET application to serve multiple requests from a single process
and
Android http connection - multiple devices cannot connect the same server
I suppose that my IIS assumes that the attempt to hit the web service from the second device is another attempt by the same device. I also suppose that it assumes the device to be the same device since it is the same application with the same internal environment hitting the web service and it can't tell that they are two different devices. I tried to reproduce this error and check if I am right by hitting the IP reporting page in IIS from two different tabs of the Mozzila Developer edition browser but it works ok (so I am not sure if it is a session issue). I also found a report that the issue is present only in android devices but it was not clear enough if the server was IIS... The solution mentioned was "incorrect flag on the tcp kernel settings - Reuse connection". Does it tell anything to anyone of you?
If the session lock is indeed the problem is there a solution to make IIS distinguish that there are two devices indeed? Is there a setting in IIS that would change this default behavior of DotNet?
I am sure there is a solution (if indeed the issue is session lock) because I uploaded my code to an on-line server and it works perfect when hitting it from two Android devices. So either it is not a session lock issue or there is a setting that it changes this behavior of DotNet in IIS... Is anyone aware of such a setting?

Running an HTTP Web Application on Android

I have a scenario where I should connect and disconnect to several WiFi endpoints from my web application and at the same time expose some REST API's. Since I come from a JVM background, I started writing a Java web application using Spring Boot and when I started to try writing WiFi connections / disconnections, I realized that it is not so easy and I had to do some ugly hacks. So I ditched the JVM and I thought that I could explot Android for this and this API from Android is exactly what I need:
https://developer.android.com/reference/android/net/wifi/WifiManager.html
I now have a Android device and this device would run as my primary server where I would like to run a Web Application that would eventually serve REST styled end points and at the same time manage my WiFi connections. I want to be able to use the Android SDK with which I could connect and disconnect to several WiFi networks, but I'm not sure as to how I could have a HTTP server that runs on Android where I can implement my classical CRUD style web application like I do in Spring Boot.
Any suggestions?

Setting up Sip call using Asterisk

I have to setup a secured sip session between android phones on 3G network. SIP signaling would be secured with TLS and media stream with SRTP. And I have never touched these protocols and components required to accomplish this.
I want to test it first with a LAN setup, for that I am trying to setup following with latest versions so that I don't miss on some security features:
Asterisk (+ Dahdi + LibPre)
Apache
MySQL
FreePBX
Sipdroid on Android.
But for reducing variables I am going to test it on two PCs with some minimalistic SIP UAs and without any secure protocols. Just to make sure that asterisk is running fine.
I have Ubuntu 10.04 running on Parallels Desktop on MacBook Pro.
Problems
What are the components needed to make this happen, meaning do I need FreePBX for Lan based call is Asterisk is not a PBX?
I have read "asterisk to asterisk" calling. Is it a SIP UA as well, I have also read that it will act as a SIP Server.
Some link where I can get myself educated to set up the environment.
Is running that on virtual machine going to work. I have tested apache and its working from another PC in my LAN.
Thanking in advance for your support.
Such setup will be too complex for beginner to be stable.
Better option(and more secure) use openvpn.org tunnel and not use TLS.
1) Freepbx is just web for simpler control asterisk. I not recomend use freepbx for public systems(for internal use it ok if firewalled). You also need add fail2ban to your installation.
3) http://www.asteriskdocs.org/, http://cdn.oreilly.com/books/9780596510480.pdf. But i am afraid you will need some REAL experience to got working what you requested.
4)Dahdi on virtual machine will not work. Conference will not work. Sound can have issues. All other would work ok.

Is there a way a browser can directly talk to android application?

It seems there is an initiative from Google to directly send the map directions from Chrome to Android device. I was wondering is there a way browser can communicate with directly an Android application, where the Android device is connected to the system by Cable. This will be helpful in some scenarios where the user does not have access to Wifi, and he wants to download the data to the mobile phone.
You use the Android Intent invocation that is available in the Android browser and demonstrated in here.
The problem that you will face is that not every app supports the ability to be opened from the Web Browser. This also relies on the fact that you are on the same machine and doesn't solve your "cabled" issue. You will also have to know how to exactly integrate with these Android apps, and that is not something that they often expose.
For a few reasons there is often no direct access to local files/devices from inside a browser. When cabled, you can forward a tcp port of the android system to local system, using Android Debugging Bridge(adb).
So you can send some commands/data to the device by setting up an application in android who listens to particular tcp port, and forward the port to local system. Then all access to the local port is forwarded to this application. Then with such techniques like jsonp, your browser can communicate with your device.

Problems transfering data between an application and a server using TCP sockets [Android]

My development team and I, are working on an application that uses a sql database, we try to transfer a database from our application to a server using tcp sockets, we made some research about sockets, the server program is written on java language using netbeans, and the application is written on eclipse.
We made several conectivity tests between the application and server programs, using the android emulator, we tried to made it local (running both programs on the same computer) and the server conects with the application, but it doesn´t receive all packages, it receives aproximately 2Kb (we want to transfer a 25Kb file), the same happens when we run the server on other computer in the same network, we made some tests using wireshark to capture all the packagesincoming from the application to the server and viceversa, we´ve noticed that the server receives all the data, but first it receives a 2Kb packet, after that server application receives an end ack, and then, the application receives the missing packages, and then discards them.
We also made some conectivity tests using a coby kyros tablet instead of the emulator, and we have no problem, the application running on the tablet, sends all the data, and the server receives it.
We want know if there are an error on the emulator, and how to solve it.
Please help us or send us yout feedback
This sounds like you are running into a configuration problem with your emulator environment. Take a look at the network configuration info for the emulator.
The fact that its working fine from the actual device suggests to me you have an emulator network configuration issue. There could be a number of issues. I imagine that wireshark can show the packets reaching the machine the emulator is on, but that doesn't mean they are making it into the virtual network the emulator is in.
To verify you'll probably need to use something like
telnet localhost <emulator port>
network capture start
... run test ...
network capture stop
and then look at the capture file. That seems like it should capture your traffic inside the emulator environment to give you an idea of whats happening.

Categories

Resources