Code example for ServerSocket

Methods: isBound

0
		} 
 
		public boolean SendDataToNetwork(final byte[] cmd) { //You run this from the main thread.
			// Wait until socket is open and ready to use 
 
			if (socket.isBound() && clientSocket.isConnected()) {
				Log.i(TAG, "SendDataToNetwork: Writing received message to socket");
				new Thread(new Runnable() {
					public void run() { 
						try { 
							os.write(cmd);
						} 
						catch (Exception e) {
							e.printStackTrace();
							Log.i(TAG, "SendDataToNetwork: Message send failed. Caught an exception");
						} 
					} 
				} 
						).start();
				return true; 
			}