Code example for Socket

Methods: getInetAddressgetInputStreamgetLocalAddressgetOutputStream

		// Each client has an associated session 
		private Session mSession;
		public WorkerThread(final Socket client) throws IOException {
			mInput = new BufferedReader(new InputStreamReader(client.getInputStream()));
			mOutput = client.getOutputStream();
			mSession = new Session(client.getLocalAddress(),client.getInetAddress());
			mClient = client;
		public void run() { 
			Request request;
			Response response;
			Log.i(TAG, "Connection from "+mClient.getInetAddress().getHostAddress());
			while (!Thread.interrupted()) {
				request = null;
Connect your IDE to all the code out there  Get Codota for Java