I've tested my code so that a PC in my office with a public IP address acts as the server
and the PC in my home behind the Xfinity router is the client.
Under this configuration, my server/client program works well.
It breaks when I reverse the roles.
The client PC (my office PC now) tries to connect with the socket of my home PC using the public IP address of my WAN. My home PC binds to its LAN IP address but I configured my router so that the it fowards packets to my home PC.