Fixed concurrency issues - works but connection times out

* use a waitgroup and channels in net.go