Mercurial > hg > Applications > TreeVNC
view src/main/java/ac/ryukyu/treevnc/server/BroadCastProxy.java @ 11:57ae9fbb1245
add files
author | Taninari YU <you@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 21 Aug 2012 14:02:05 +0900 |
parents | |
children |
line wrap: on
line source
package ac.ryukyu.treevnc.server; import java.io.IOException; import java.io.PrintStream; import java.net.Socket; public class BroadCastProxy { private String str; private Socket socket = null; private PrintStream os = null; private int port = 8182; public BroadCastProxy(String _str) { str = _str; } void createSocket(String addr) { while (true) { try { Thread.sleep(1000); socket = new Socket(addr, port); os = new PrintStream(socket.getOutputStream()); sendData(); os.close(); socket.close(); break; } catch (IOException e) { System.out.println("Connection faild"); continue; } catch (InterruptedException e) { e.printStackTrace(); } } } void sendData() { os.println(str); } }