Android sensors reception to sockets - java

I have been unable to manipulate a problem of receiving a data from sensors and send them via a socket in its own thread without loosing a data.
I have an Android service that needs to receive data from sensors. I want to open a TCP socket that connects to a PC to send the gathered data. My problem is that receiving data is fater than the socket task, it is unable to send all data gathered by sensors, since the socket service is doing things with interface.
Please any idea where I may find an example of a socket in synchronization with the reception of data?

This may help: Using an iOS device to control a game on your browser
Since they are using standard html5 I think it is possible to implement the same in andorid.
Plus nodejs and socket.io are great.

Related

Two way communication between Android and PC

I am working on an Android application which is making real time communication between Android device and PC.
I want to record audio signal and then send it to a server where it will be save to .wav file online.
By now I made an application which is streaming audio and playing it, but I want to save that bytes to a file on the computer.
The problem is that, can I send command from server which firstly starts an streaming applcation on Android and then send command which stops receiving bytes? It will allows me to get array with bytes, which can be save to .wav file.
I'm using TCP protocol.
You may use a socket connection between you computer and the mobile device that the PC may use to notify that the android should start streaming (or even transfer the bytes stream through it).
There is a bunch of libraries (on both client and server side) that implements socket communication. Two big player there are:
SignalR
Socket.io
You may also use the Android Socket API to implement that (if you don't want to use a third party library)
Socket - Android Developers

Audio conference using jsp servlet

I want a make a setup where each client send their audio stream to a server. Now server mix up different audio stream and broadcast to every client and client play that sound. I tried webrtc to grab the microphone now I faced the problem how I send the data to server. Some how websocket send the blob to the server I got another issue how I mix them up and maintain synchronization. I am planing to do this using java. Most importantly I have to store the entire audio communication to server for later use.

P2P communication , chat App (android)

i am using this tutorial as guide. i am creating an android app which is basically chat application. this uses socket programming to communicate .
i want to connect directly to device and deliver the message. the message does not go to server. server only tell me the address of the device thats it.
i followed the tutorial i mentioned above and this only works for the case where client and server are within same wifi/network. i want to connect to server from client irrespective of their network connection place. how do i do it from any network to any network.
i think i need to use port forwarding , but this is not practical . so we better use a server for keeping track of all the ip changes. and deliver the messages directly from the source to client. so how do i do it. please suggest any resources.
update
as of now what i studied is i have to use innetaddress to communicate if i am inside an wifi router.
thank you

KryoNet - Sending packets to Android clients

I am developing an Android app which has to connect clients to my server for sending/receiving different sort of packets. To achieve that, I am using the KryoNet library. My clients connect themself to the server and send their own packets successfully. But my problem is that the server seems to failed at responding to them. I have registered these packets in the same order on the server side and the client side and I use the connection parameter of the overrided reveived method from kryonet.Listener to respond (e.g. connection.sendUDP(...)). I have an Android 5.0.2, I use the 2.22.0-RC1 version of KryoNet both on the server side and the client side... With the option Log.set(Log.LEVEL_DEBUG) enabled, I can see that the server starts to write a packet
(DEBUG: [kryo] write: PacketMovement) but I receive nothing.
I would really appreciate any help on this issue.
The answer for people having the same problem : https://github.com/EsotericSoftware/kryonet/pull/111.

Packet Sniffer/Filter in Android using VPN

I want to build a sniffer in Android and one of the approaches that was proposed was a loop-back VPN.
The issue with this approach is that all the communication with the outside world will be done through a protected socket and in Java I still cannot sniff low level TCP information from that socket.
For example, I cannot find out when exactly an ACK was received for data that was sent from the phone. Am I missing something or is this approach simply not suitable for a proper sniffer?
You won't be able to get ack information and other low level info using an Android VPN as this data won't be exposed through Java sockets.
An alternative is to utilize a native sniffer (TCPdump is one example, and an Android port already exists), execute it as root from your Java app and then retrieve its output in your app

Categories

Resources