• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Android/Java networking

9Ate7

Newbie
Hi,

Been doing some android networking lately. Having some trouble actually sending the data back and forth. The following is a simple explanation of what i have running now.

Java -> Server (runs on the desktop)
-its job is to constantly listen on a port and connect clients. Once a client connects, it creates a new JFrame with a graphics class.(Basically a giant canvas) There is a separate thread that is always listening to the client.

Android -> Client
An android device is the client. Its job is to connect to the server, with a given IP/Port. Once the connection has been established, it changes (setView) the view to a canvas. On the canvas there is a box that moves based on touch input.

Objective
The box moves on the android screen, but it doesn't move in the JFrame window.

I think the information is not being relayed. I have tried dataOutputStream. But for some reason there is a major Lag in sending the information. (Not waiting for serverSocket)

Basically i want a real time updates. As the box moves on the android device, it should also move on the JFrame.

EDIT: In the Long run, i want to send a string of information, which can be used to play a simple lan game.
 
Hi,

Been doing some android networking lately. Having some trouble actually sending the data back and forth. The following is a simple explanation of what i have running now.

Java -> Server (runs on the desktop)
-its job is to constantly listen on a port and connect clients. Once a client connects, it creates a new JFrame with a graphics class.(Basically a giant canvas) There is a separate thread that is always listening to the client.

Android -> Client
An android device is the client. Its job is to connect to the server, with a given IP/Port. Once the connection has been established, it changes (setView) the view to a canvas. On the canvas there is a box that moves based on touch input.

Objective
The box moves on the android screen, but it doesn't move in the JFrame window.

I think the information is not being relayed. I have tried dataOutputStream. But for some reason there is a major Lag in sending the information. (Not waiting for serverSocket)

Basically i want a real time updates. As the box moves on the android device, it should also move on the JFrame.

EDIT: In the Long run, i want to send a string of information, which can be used to play a simple lan game.
Here I am very new in the android forums, however if you where able to produce some code of a simple mockup off what you are attempting then I am sure we could help in some way. They do like their code in this forum.
HIIH

PS You could try using some of this example code listed
http://stackoverflow.com/questions/12862052/how-can-i-create-network-streams-in-java-android

http://stackoverflow.com/questions/5042548/sending-udp-packages-from-android-2-2-htc-desire
 
Back
Top Bottom