Socket API based on coroutine.