extract network IO code to NetworkIOHandler