Fixed htons() in cycle. Changed select() with poll().