Barely working TCP accept() implementation