| 35 | private long lastSentTime; |
| 36 | |
| 37 | public Connection(String ip, int port) throws IOException |
| 38 | { |
| 39 | SocketAddress sockaddr = new InetSocketAddress(ip, port); |
| 40 | socket = new Socket(); |
| 41 | |
| 42 | socket.connect(sockaddr, Constants.TIMEOUT_CONNECTING); |
| 43 | |
| 44 | socket.setSoTimeout(Constants.TIMEOUT_KEEPALIVE); |
| 45 | out = new PrintWriter(socket.getOutputStream(), true); |
| 46 | in = new BufferedReader(new InputStreamReader(socket.getInputStream())); |
| 47 | |
| 48 | lastReceivedTime = System.currentTimeMillis(); |
| 49 | lastSentTime = System.currentTimeMillis(); |
| 50 | |
| 51 | } |
| 52 | |
| 53 | public Connection(Socket socket) throws IOException |
| 54 | { |