select I/O

add a two error handler fucntions. And use select function set 5s for wait, if overtime, return directly.