Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1563 - 1
package dongfang.mkt.comm.tcp;
2
 
3
import java.io.IOException;
4
import java.io.InputStream;
5
import java.io.OutputStream;
6
import java.net.Socket;
7
 
8
import dongfang.mkt.comm.MKConnection;
9
 
10
public class MKTCPConnection implements MKConnection {
11
        private InputStream inputStream;
12
        private OutputStream outputStream;
13
 
14
        @Override
15
        public void init(String id) throws IOException {
16
                //URL url = new URL(id);
17
                Socket socket = new Socket("localhost", Integer.parseInt(id));
18
                inputStream = socket.getInputStream();
19
                outputStream = socket.getOutputStream();
20
        }
21
 
22
        @Override
23
        public InputStream getInputStream() throws IOException {
24
                return inputStream;
25
        }
26
 
27
        @Override
28
        public OutputStream getOutputStream() throws IOException {
29
                return outputStream;
30
        }
31
}