slightly modify
using gevent for network io