在线等待,关于socket的问题,请高手不吝赐教(200分)

  • 主题发起人 leatarget
  • 开始时间
L

leatarget

Unregistered / Unconfirmed
GUEST, unregistred user!
我和远程的一个socket服务器连接,运行一段时间就会出现网络错误,号码是100038
请问任何解决??
 
在onerror中将code:=0,这样就什么异常也不会出现了,反正也是线路忙,出现这种情况
就干脆来一个messagedlg('服务器忙',……)行了吗?
 
哪位老兄帮帮吗?
 
是10038。
在全文检索处查找一下10038。
http://richsearch.com/
 
try
……
except
空过程;
end;
 
我知道,设置errorno=0
后,我是在在日志中记录100038的意思是不是一个合法的socket。
我就不理解了,必须重新启动我的程序,才不继续报错
 
只要把弹出错误消息的窗口关掉,程序还会继续运行,所以上面我写的都是容错的
 
?,你说的我不明白?
 
WinSock Error Codes
The following error codes apply to the WinSock ActiveX Controls.

Error Code Error Message
10004 The operation is canceled.
10013 The requested address is a broadcast address, but flag is not set.
10014 Invalid argument.
10022 Socket not bound, invalid address or listen is not invoked prior to accept.
10024 No more file descriptors are available, accept queue is empty.
10035 Socket is non-blocking and the specified operation will block.
10036 A blocking Winsock operation is in progress.
10037 The operation is completed. No blocking operation is in progress.
10038 The descriptor is not a socket.
10039 Destination address is required.
10040 The datagram is too large to fit into the buffer and is truncated.
10041 The specified port is the wrong type for this socket.
10042 Option unknown, or unsupported.
10043 The specified port is not supported.
10044 Socket type not supported in this address family.
10045 Socket is not a type that supports connection oriented service.
10047 Address Family is not supported.
10048 Address in use.
10049 Address is not available from the local machine.
10050 Network subsystem failed.
10051 The network cannot be reached from this host at this time.
10052 Connection has timed out when SO_KEEPALIVE is set.
10053 Connection is aborted due to timeout or other failure.
10054 The connection is reset by remote side.
10055 No buffer space is available.
10056 Socket is already connected.
10057 Socket is not connected.
10058 Socket has been shut down.
10060 The attempt to connect timed out.
10061 Connection is forcefully rejected.
10201 Socket already created for this object.
10202 Socket has not been created for this object.
11001 Authoritative answer: Host not found.
11002 Non-Authoritative answer: Host not found.
11003 Non-recoverable errors.
11004 Valid name, no data record of requested type.
 
是不是网络不稳定,报错太多了,我是一直把错误屏蔽了。是不是socket认为错误太多,
就把当前的socket实例认为是非法的了?
100038的errorevent 是eesend类型
 
先做一个最简单的服务器客户端, 在本机上测试看看,分析是网络原因? 还是组件原因? 还是什么原因, 到时再按情况处理吧,
用到收发信息时, 或定时检查连接状态, 如果不对, 就断开重连,
 
是不是还有其它线程在调用此端口,所以造成端口冲突了。
很有这个可能!
 
TPubErrHandle = class(TObject)
public
procedure handException(Sender: TObject; E: Exception); //自己随便写,空函数也行
end;
在主form的create事件中加入
PubErrHandle := TPubErrHandle.Create ;
Application.OnException := PubErrHandle.handException;
 
从当前的状态看,是网络连接没有问题,以为socket一直没有断开,
是在send的时候出的错误,以为100038是eesend类型的错误。
nibul已经把socket错误贴出来了。就是100038的错误,其他的错误也出现,
但是,一旦出现100038就会不停的出现这个错误。
必须把程序关闭,然后在起来。又会正常一段时间。然后又是100038错误。
我要不要把代码贴出来?
 
好啊!大家都来看看!
 
nibul,你的代码其什么作用?
 
就是禁止弹出所用错误窗体!!!!!!
 
也就是说捕捉错误,然后自己处理
 
我是把所有的错误都屏蔽了,然后errorno=0就不会弹出错误窗体了。
 
顶部