Your system sends to this address:
InetSocketAddress sd=new InetSocketAddress("192.168.8.101",40000);
The other system sends to:
InetSocketAddress sd=new InetSocketAddress("192.168.8.101",50000);
Did you see it now? The other systems sends the data to himself on port 50000. You have to specify the IP address of your system.
Note also that for receiving it would be better to move the socket creations and closing of the sockets out of the
while(true)
loops.