WIP: Network stack enh.

Code for #303

This contains the final dev version of code, needs another pass of code review.

This code has been profiled though instruments with one adverse leak detected in existing code (added a #warning).

Please review at your convenience, I will update the Pull Request before it is ready for merge. 

During the refactor I also updated several places to modern objc. and removed some dead code.