Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (中文) » UltraLite - 数据库管理和参考 » UltraLite 用作 MobiLink 客户端 » UltraLite 同步参数和网络协议选项 » UltraLite 的同步参数

 

Stream Error 同步参数

提供一个用来保存通信错误报告信息的结构。

语法

根据所使用的 API 不同,语法会有所变化。

适用于

此参数仅适用于 C/C++ 接口。

允许值

此参数没有缺省值,因而必须使用支持的字段之一进行显式设置。ul_stream_error 字段如下所示:

  • stream_error_code   非必需字段。值始终为 0。

    有关错误号的列表,请参见MobiLink 通信错误消息。有关错误代码后缀的信息,请参见 install-dir\SDK\Include\sserror.h

  • system_error_code   系统特定的错误代码。有关错误代码的详细信息,必须查看平台文档。对于 Windows 平台,此文档是 Microsoft Developer Network 文档。以下是 Windows 上的常见系统错误:

    • 10048 (WSAADDRINUSE)   地址已经在使用。

    • 10053 (WSAECONNABORTED)   软件导致连接中止。

    • 10054 (WSAECONNRESET)   通信的另一端关闭了套接字。

    • 10060 (WSAETIMEDOUT)   连接超时。

    • 10061 (WSAECONNREFUSED)   连接被拒绝。通常情况下,这表示 MobiLink 服务器没有运行或者没有在指定的端口上监听。请参见 [external link] Microsoft Developer Network Web 站点

  • error_string   应用程序提供的错误消息。该字符串可能是空的,也可能不是空的。除 stream_error_code 以外,非空的 error_string 还提供其它信息。例如,对于写入错误(错误代码 9),错误字符串是一个表示试图写入的字节数的数字。

  • error_string_length   不建议使用。错误字符串缓冲区的大小。

注释

UltraLite 应用程序(UltraLite C++ 组件除外)将通信错误信息作为同步结果参数的一部分接收。请参见Sync Result 同步参数

stream_error 字段是类型为 ul_stream_error 的结构。

typedef struct {
    ss_error_code stream_error_code;
    asa_uint16    alignment;
    asa_int32     system_error_code;
    char          error_string[UL_STREAM_ERROR_STRING_SIZE];
} ul_stream_error, * p_ul_stream_error;

结构被定义在 install-dir\SDK\Include\sserror.h 文件中。

检查 SQLE_COMMUNICATIONS_ERROR:

Connection conn;
ul_synch_info info;
...
conn.InitSynchInfo( &info );
info.stream_error.error_string = error_buff;
info.stream_error.error_string_length =
                   sizeof( error_buff );
if( !conn.Synchronize( &synch_info ) ){
    if( SQLCODE == SQLE_COMMUNICATIONS_ERROR ){
        printf( error_buff );
    // more error handline here
另请参见