networking with sockets like java-mode
in
Android Processing
•
1 year ago
Hi
I would like send data from my android phone to desktop pc with tcp sockets.
I testet with a processing program from an other pc with this code:
But, if I start the app and tap the screen, the window was filled with light gray and the applications stops with a messagebox "appppp... stoped" OK
Where can be the problem?
All devices are in the same network and transferes data over wifi.
I'm thankful for a hint.
PS:No, I want not use osc messages!
I would like send data from my android phone to desktop pc with tcp sockets.
I testet with a processing program from an other pc with this code:
- import java.io.*;
import java.net.*;
Socket sock = null;
PrintWriter out = null;
void setup()
{
orientation(PORTRAIT);
try
{
sock = new java.net.Socket("172.16.2.215", 4000);
out = new PrintWriter(sock.getOutputStream(), true);
}
catch (UnknownHostException e)
{
println(e);
}
catch (IOException e)
{
println(e);
}
}
void draw()
{
background(50);
}
void mousePressed()
{
out.println("mouseX: " + mouseX + "\r");
}
void exit()
{
try
{
out.close();
sock.close();
}
catch (IOException e)
{
println(e);
}
println("the end");
super.exit();
}
But, if I start the app and tap the screen, the window was filled with light gray and the applications stops with a messagebox "appppp... stoped" OK
Where can be the problem?
All devices are in the same network and transferes data over wifi.
I'm thankful for a hint.
PS:No, I want not use osc messages!
1