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
{
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
;
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());
29 public void close() throws Exception
31 socket
.shutdownInput();
32 socket
.shutdownOutput();
37 public boolean isOpen() {
41 public ConnectionInfo
getConnectionInfo() {
42 return connectionInfo
;