moved eof to separated rpc method (should be called by data session, otherwise, data loss will be occurred)