/* * Write at most 'len' characters */ int net_send( void *ctx, unsigned char *buf, int len ) { int ret = write( *((int *) ctx), buf, len ); if( ret < 0 ) { if( net_is_blocking() != 0 ) return( XYSSL_ERR_NET_TRY_AGAIN ); #if defined(WIN32) || defined(_WIN32_WCE) if( WSAGetLastError() == WSAECONNRESET ) return( XYSSL_ERR_NET_CONN_RESET ); #else if( errno == EPIPE || errno == ECONNRESET ) return( XYSSL_ERR_NET_CONN_RESET ); if( errno == EINTR ) return( XYSSL_ERR_NET_TRY_AGAIN ); #endif return( XYSSL_ERR_NET_SEND_FAILED ); } return( ret ); }