Found necessary flag for non-blocking linux sockets and adjusted main accordingly