resolve issue #40 by using poll.
And revise algorithm to connect.(for IPv6)