Mercurial > hg > RemoteEditor > Eclipse
view src/remoteeditor/network/REPPacketReceive.java @ 206:563057fe244e
source code clean up
author | one |
---|---|
date | Sat, 18 Dec 2010 18:01:07 +0900 |
parents | a78e0429bee2 |
children |
line wrap: on
line source
package remoteeditor.network; import java.io.IOException; import java.nio.channels.SocketChannel; import remoteeditor.command.REPCommandEvent; import remoteeditor.command.REPCommandListener; import rep.REPCommand; import rep.REPCommandPacker; public class REPPacketReceive implements Runnable{ SocketChannel socketchannel; private REPCommandListener commandlistener; REPCommandPacker p = new REPCommandPacker(); public REPPacketReceive(SocketChannel sc){ socketchannel = sc; } public void addCommandListener(REPCommandListener listener){ commandlistener = listener; Thread th = new Thread(this); th.start(); } public void run() { while(socketchannel.isConnected()){ try { commandlistener.CommandReceived(new REPCommandEvent(p.unpackUConv(socketchannel))); } catch (IOException e) { return; } } } public REPCommand unpackUConv() throws IOException { return p.unpackUConv(socketchannel); } }