Java network programming explain detail