怎么没人回答呢?简而言之就是阻塞的socket怎么会出现这样的错误???
用的是C#的默认设置,并且未改过blocking属性的值...

解决方案 »

  1.   

    最近发现都是在处理chunked数据是抛出的这个异常,
    我根据RFC2068写的chunked解码如下:
                        //try to receive the chunk size to the buffer...
                        while (m_Socket.Receive(chunk, 0, 1, SocketFlags.None) > 0)
                        {
                            if (bflag) break;                        if (chunk[0] == '\r')
                                bflag = true;
                            else if (chunk[0] == ';')
                                bsemicolon = true;
                            //add byte to the strChunksize before the semicolon...
                            else if(!bsemicolon)
                                strChunksize += CrawlController.s_DefaultEncoding.GetString(chunk, 0, 1);
                        }
                        //parsing the chunk size...
                        nSize = Int32.Parse(strChunksize, System.Globalization.NumberStyles.HexNumber);                    //has met the end...
                        if (nSize == 0)
                        {
                            //receive the last CR LF
                            m_Socket.Receive(chunk, 0, 2, SocketFlags.None);
                            break;
                        }                    //try to receive the chunked-data by the specified size
                        while (nSize > 0)
                        {
                            if (nSize > s_ContentBufferSize)
                            {
                                nBytes = m_Socket.Receive(chunk_data, 0, s_ContentBufferSize, SocketFlags.None);
                            }
                            else
                            {
                                nBytes = m_Socket.Receive(chunk_data, 0, nSize, SocketFlags.None);
                            }
                            nSize -= nBytes;
                            nTotalBytes += nBytes;                        strResponse += s_DefaultEncoding.GetString(chunk_data, 0, nBytes);
                        }                    //received the '\r\n' at the tail of the chunked-data
                        m_Socket.Receive(chunk, 0, 2, SocketFlags.None);                    Thread.Sleep(0);
                    }
    其中try块就省略了,不然太长了,catch了SocketException,ArgumentException和ObjectDisposedException。一直令我感到不解的是,为什么我用的阻塞模式socket也会出现 10035 异常??太奇怪了
      

  2.   

    就我一个人绕来绕去.........晕为什么blocking的socket运行也会抛出10035 “无法完成一个非阻止性套接字操作”的exception !!!!!!!!!!!!!!!!!!!!!!!!!!!
      

  3.   

    我也遇到同样的问题!
    web端通过web service访问C/S端
    其中C/S端与web service通过套接字通讯。
    默认情况下是用的阻塞模式。
    在web端向服务器端发送数据的时候一开始是正常的。
    但是,狂点几下就报错了“无法立即完成一个非阻塞套接字操作!”
      

  4.   

    Receive的时候抛出来的!
    郁闷了,我在winform里试随便怎么点都不回报错!
    搞在WEB上就报错了。
    我的WEB端是用AJAX异步访问页面方法,然后页面方法再和WEB Service通信;
    WEB Service用套接字和c/s端通信!其中web service作为服务器监听C/S端,一旦建立连接之后,web端就用这个套接字来向服务端发送数据。
      

  5.   

    我和楼上遇到的情况一样.
    也是WEB Service用套接字和c/s端通信.
    也遇到“无法立即完成一个非阻塞套接字操作!”的问题,
    现在也不知道怎么解决,怎么办啊,有没有高人帮忙解决一下呀,先谢谢了。
      

  6.   

    我的问题解决了,你看一下下面这个网址,对你应该有帮助
    http://social.msdn.microsoft.com/Forums/en-US/netfxnetcom/thread/726b9516-0ccd-40e1-829f-2fd5998904d4