Sometimes after switching the network connection (wired/wireless) TeamViewer service hangs. To fix this, restart teamviewer service. Open a terminal and execute the following commands :
# sudo
teamviewer daemon stop
# sudo teamviewer daemon start
Wait for a few seconds, after few second it's working: