Edited code by denhua so TCP works in latest version.