SuperSocket.ClientEngine icon indicating copy to clipboard operation
SuperSocket.ClientEngine copied to clipboard

EasyClient Close的时候出现错误一个封锁操作被对 WSACancelBlockingCall 的调用中断

Open talentJian opened this issue 7 years ago • 6 comments

我使用的是3.5编译出来的ClientEngine,但是发现 每次服务器主动关闭,或者说客户端调用Close 都会报这个错误。。

Error:一个封锁操作被对 WSACancelBlockingCall 的调用中断。

另外还有一个问题。。EasyClient 有没办法能把 连接的结果 和 错误的回调 分开?

talentJian avatar May 14 '17 03:05 talentJian

Do you have a test project to produce this issue?

kerryjiang avatar May 22 '17 05:05 kerryjiang

public EasyClient easyClient;
    public void Connect(string ip,int port)
    {
        easyClient = new EasyClient();
        easyClient.NoDelay = true;
        easyClient.Initialize<BinaryPackageInfo<int>>(new GameReceiveFilter(), MsgHandler);
        easyClient.Connected += easyClient_Connected;
        easyClient.Closed += easyClient_Closed;
        easyClient.Error += easyClient_Error;
        easyClient.BeginConnect(new IPEndPoint(IPAddress.Parse(ip), port));
    }

    void easyClient_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
    {
        Debug.Log("EasyClent Error :" + e.Exception.Message);
        BinaryPackageInfo<int> msg = new BinaryPackageInfo<int>((int)ProtocolConst.Error, null);
        lock (msglock)
            msg_queue.Add(msg);
    }
  private void MsgHandler(BinaryPackageInfo<int> msg)
    {
        lock (msglock)
            msg_queue.Add(msg);
    }

我是在Unity 里使用 ClientEngine的,编译版本为3.5,基本每次 Close都会触发这个error的事件 跟提供的例子一样。。报错是在监听的 Error事件里发生的

talentJian avatar May 22 '17 05:05 talentJian

能把Exception的StackTrace log一下吗?

kerryjiang avatar May 22 '17 06:05 kerryjiang

Stack Trace 是 Null Socket Error 是 Interrupted Err Code 10004

talentJian avatar May 22 '17 06:05 talentJian

只有Exception.Message 是有信息的

talentJian avatar May 22 '17 07:05 talentJian

Do you have a piece of sample code to produce this issue?

I cannot reproduce it by my test case.

kerryjiang avatar May 28 '17 19:05 kerryjiang