I am trying to send an image from the android phone, process it on the server side, and then get it back to the phone. I have been able to send the file from the phone to the server but then it seems that the server cannot send the image using the same socket. I am using bufferedinputstream and bufferedoutputsteram. is it possible or would i need 2 different ports? code is in java.
It is possible to have a 2-way-communication by using one socket connection.
In easy words: the server's outputstream is the client's inputstream and vice versa.
Related
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
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.
I'm writing a bluetooth related application, and I'm using a API called BlueCove if you're familiar with it.
I managed to send some text from the client to a server, however I'm not familiar with the API for sending information from a server to a client so I couldn't send any information back to the client. I want to know how to do that.
Could anyone point me to it? I'm really unfamiliar with the API. Thanks
Turns out to be a really simple thing. Bluetooth provides different ways to communicate between devices, and one of them is using DataStream. Set up the following on both server and client side, and they'll be able to talk to each other:
StreamConnection conn = (StreamConnection)Connector.open(url);
DataOutputStream output= new DataOutputStream(conn.openOutputStream());
DataInputStream input = new DataInputStream(conn.openInputStream());
Whatever is put in DataOutputStream on one end, it'll come out in DataInputStream on the other side of the connection, regardless whether it's a server/client. DataInputStream and DataOutputSream's API are found in the link.
I need to send a few strings from a java project (Windows or Ubuntu) to an Android device via WiFi means. I found a few sources on how to send files from Android device to Android device but I didn't find anything cross platform. Can someone suggest me a way to do it, or a lead about where to look ?
I am open to alternate methods, but as always the simplest the better.
Thanks in advance.
I would write a simple REST web service for the android client to check. That way if you wanted to for whatever reason you could move it to the cloud and do it remotely. That is probably the simplest way I can think of as well.
I would suggest send it through TCP connection.
Because Both Java and Android have ServerSocket class and Socket class.
You can set your computer to be host by using ServerSocket and your Android device to be client by using Socket.
Then after connection, you can use getInputStream() and getOutputStream() methods of Socket to transfer data, including Strings, Objects and even Files with suitable combination of FileInputStream,ObjectOutputStream etc.
One of my web applications have developed in java and using tomcat server. Now I want add one more feature in my application that is peer to peer audio streaming. Actually I want that anyone speak (using microphone) on the client side and I will hear his voice on my server speakers and vice versa. Also save our communication in any file and also send the audio stream to IP intercom.
For that I am trying to use Flex Builder. Flex NetStream class is good for the streaming and we can also attached microphone. But the problem is on the server side. How can I get the audio stream on server side?
Or any other idea how can I get stream from server to client and vice versa?
I think the easiest way to do this would just be to run another client on your server. Maybe even a "special client".