Code example for Socket

Methods: getInetAddress, getInputStream, getOutputStream

0
		 
		// Each client has an associated session 
		private Session session;
		 
		public WorkerThread(final Socket client, final Handler handler) throws IOException {
			this.input = new BufferedReader(new InputStreamReader(client.getInputStream()));
			this.output = client.getOutputStream();
			this.session = new Session(client.getInetAddress(), handler);
			this.client = client;
			this.handler = handler;
		} 
		 
		public void run() { 
			Request request;
			Response response;
			 
			log("Connection from "+client.getInetAddress().getHostAddress());
 
			while (!Thread.interrupted()) {
				try { 
					// Parse the request