wince 6用socket时出现:试图对无法访问的主机执行套接字操作

[复制链接]
查看11 | 回复2 | 2021-1-27 05:27:06 | 显示全部楼层 |阅读模式
--------------------------------------------------------
--------------------------------------------------------
日志入口:
15:27:062014年12月10日
System.Net.WebException:无法连接到远程服务器--->System.Net.Sockets.SocketException:试图对无法访问的主机执行套接字操作
位于System.Net.Sockets.Socket.ConnectNoCheck(EndPointremoteEP)
位于System.Net.Sockets.Socket.Connect(EndPointremoteEP)
位于System.Net.Connection.doConnect(IPEndPointep)
位于System.Net.Connection.connect(Objectignored)
位于System.Threading.ThreadPool.WorkItem.doWork(Objecto)
位于System.Threading.Timer.ring()
位于System.Net.HttpWebRequest.finishGetResponse()
位于System.Net.HttpWebRequest.GetResponse()
位于EPSTerminalWinCE.HttpWebResponseDecompressed..ctor(WebRequestrequest)
位于EPSTerminalWinCE.EPSServiceCEProxy.GetWebResponse(WebRequestrequest)
位于System.Web.Services.Protocols.SoapHttpClientProtocol.doInvoke(StringmethodName,Object[]parameters,WebClientAsyncResultasyncResult)
位于EPSTerminalWinCE.EPSProxy.EPSTerminalService.GetVersionNumber()
位于EPSTerminalWinCE.EpsLogin.JustCurrAppVersion()
位于EPSTerminalWinCE.EpsLogin.LoginUI_Load(Objectsender,EventArgse)
位于System.Windows.Forms.Form.OnLoad(EventArgse)
位于System.Windows.Forms.Form._SetVisibleNotify(BooleanfVis)
位于System.Windows.Forms.Control.set_Visible(Booleanvalue)
位于System.Windows.Forms.Application.Run(Formfm)
位于EPSTerminalWinCE.Program.Main()
--------------------------------------------------------
--------------------------------------------------------
这是wince的日志,由于wince终端硬盘启动不可修改模式winform程序不能写日志,但是只要网络一断开winform程序就会产生异常自动退出,目前客户就是要求网络断开后winform不能退出,需停留在当前界面,等网络连接正常后还可以继续当前任务。不知道各位大神们有什么好的建议没,谢了!
分 -->
回复

使用道具 举报

千问 | 2021-1-27 05:27:06 | 显示全部楼层
网络一断开winform程序就会产生异常自动退出,这是因为你没有监控网络断开的事件,还在按网络仍然连接进行操作吧。
回复

使用道具 举报

千问 | 2021-1-27 05:27:06 | 显示全部楼层
是的,我昨天已经加了全局异常捕获了,catch里面不加参数,直接return,我写了个winform程序试了,这样处理之后产生异常不会有任务提示,而且继续执行程序如果没有异常的话还会执行成功的,不知大神你有何建议,请指教。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行