A perfect working TCP version(Doesn't hang :D)