Merge pull request #8 from yifan-gu/master

fix outputfile
finish transfering single file
add macro MAX_TIMOUT
have some timeout bugs