Code example for Socket

Methods: getInetAddress, getInputStream, getLocalAddress, getOutputStream

0
 
		// 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;
				response = null;