Mercurial > hg > Members > you > BroadCastTreeVNC
view src/treeVnc/BroadCastProxy.java @ 5:970d5ac80256
add MyDataInputStream.java and DataInputStream1.java
author | one |
---|---|
date | Mon, 23 Apr 2012 21:10:23 +0900 |
parents | 756bfaf731f3 |
children |
line wrap: on
line source
package treeVnc; 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); } }