create IOServer constructor to encapsulate server logic