Remove TODO file
[remote/remote-gui.git] / src / motecontrol / client / Connection.java
blob1329b424a9a19f884699077a725578cdde5756e5
1 package diku.distlab.motecontrolclientlib.client;
3 import java.io.DataInputStream;
4 import java.io.DataOutputStream;
5 import java.net.Socket;
7 public class Connection {
8 private Socket socket;
9 private boolean open = false;
10 public DataInputStream is;
11 public DataOutputStream os;
13 ConnectionInfo connectionInfo;
15 public Connection(ConnectionInfo connectionInfo) throws Exception
17 this.connectionInfo = connectionInfo;
18 open();
21 public void open() throws Exception
23 socket = new Socket(connectionInfo.getServerName(),connectionInfo.getPort());
24 is = new DataInputStream(socket.getInputStream());
25 os = new DataOutputStream(socket.getOutputStream());
26 open = true;
29 public void close() throws Exception
31 socket.shutdownInput();
32 socket.shutdownOutput();
33 socket.close();
34 open = false;
37 public boolean isOpen() {
38 return open;
41 public ConnectionInfo getConnectionInfo() {
42 return connectionInfo;