Fix bug of exception handling. Resize socket receive buffer.