new Client acts strangely
in
Core Library Questions
•
2 years ago
hej forum,
i am working on an installation, controlling video projectors with the client class
everything works fine with my beamers connected, but i would like to be able to catch if the beamers for some reason aren't connected. if i try to create a Client with a non-existing IP, i get erratic results. every second time or so, i get the following error msg:
and the program continues. other times the program hangs.java.net.NoRouteToHostException: No route to hostat java.net.PlainSocketImpl.socketConnect(Native Method)at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)at java.net.Socket.connect(Socket.java:529)at java.net.Socket.connect(Socket.java:478)at java.net.Socket.<init>(Socket.java:375)at java.net.Socket.<init>(Socket.java:189)at processing.net.Client.<init>(Client.java:75)at opening_client.setup(opening_client.java:34)at processing.core.PApplet.handleDraw(PApplet.java:1608)at processing.core.PApplet.run(PApplet.java:1530)at java.lang.Thread.run(Thread.java:680)
is there a possibility of avoiding the program hanging? some try / catch exception trick perhaps?
below is a sample program with the described behavoir:
- import processing.net.*;
- Client myClient;
- String ip = "169.254.100.100";
- int port = 10000;
- void setup() {
- size(600, 250);
- println("attempting to open client");
- myClient = new Client(this, ip, port);
- println("done");
- noLoop();
- }
- void draw() {
- println("tut tut");
- }
1