replaced "res" with "listenfd" per variable change. Thanks Chris for catching that