Code example for Socket

Methods: getInetAddressgetInputStreamgetOutputStream

		// 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());
			this.client = client;
			this.handler = handler;
		public void run() { 
			Request request;
			Response response;
			log("Connection from "+client.getInetAddress().getHostAddress());
			while (!Thread.interrupted()) {
Connect your IDE to all the code out there  Get Codota for Java