怎么没人回答呢?简而言之就是阻塞的socket怎么会出现这样的错误???
用的是C#的默认设置,并且未改过blocking属性的值...
用的是C#的默认设置,并且未改过blocking属性的值...
解决方案 »
- winform中嵌入word问题
- dataGridView能不能做到2点?
- C# Webbrowser 浏览器地址栏地址怎么保存到xml文档?
- 如何把当前选中的checkboxlist项,添加到另外一个checkboxlist
- --------
- 很简单的建类问题!!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- 服务器上 IIS 实现 VS 的发布功能
- 这个问题(C#+SQL)是怎么搞的?
- 如何向空ACCESS数据文件添加表?
- 请大家帮忙看看,数据绑定的问题
- ajax(不用别的框架直接使用javascript调用服务端的方法)
- vs2008还是用vss2005吗?又没有更好的工具,或者更新的工具?
我根据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 异常??太奇怪了
web端通过web service访问C/S端
其中C/S端与web service通过套接字通讯。
默认情况下是用的阻塞模式。
在web端向服务器端发送数据的时候一开始是正常的。
但是,狂点几下就报错了“无法立即完成一个非阻塞套接字操作!”
郁闷了,我在winform里试随便怎么点都不回报错!
搞在WEB上就报错了。
我的WEB端是用AJAX异步访问页面方法,然后页面方法再和WEB Service通信;
WEB Service用套接字和c/s端通信!其中web service作为服务器监听C/S端,一旦建立连接之后,web端就用这个套接字来向服务端发送数据。
也是WEB Service用套接字和c/s端通信.
也遇到“无法立即完成一个非阻塞套接字操作!”的问题,
现在也不知道怎么解决,怎么办啊,有没有高人帮忙解决一下呀,先谢谢了。
http://social.msdn.microsoft.com/Forums/en-US/netfxnetcom/thread/726b9516-0ccd-40e1-829f-2fd5998904d4