Move struct _iostream's declaration to header file
Update connection related code