【发布时间】:2020-11-02 08:49:37
【问题描述】:
如果我发送另一个请求,winform 长时间打开时会出现一个问题,错误是为 flowlayout 面板控件清除创建窗口句柄:
flw.Invoke(new Action(() => flw.Controls.Clear()));
错误: ERROR OnExampleDTOReceived:创建窗口句柄时出错。-->-->System.ComponentModel.Win32Exception:创建窗口句柄时出错。 在 System.Windows.Forms.Control.MarshaledInvoke(控制调用者,委托方法,对象 [] 参数,布尔同步) 在 System.Windows.Forms.Control.Invoke(委托方法,对象 [] 参数) 在 \Source\Workspaces\TestApplications\PrxCustScr\PrxCustScr\Sockets\Listener.cs 中的 PrxCustScr.Sockets.Listener.EndTrx(字符串数据,FlowLayoutPanel flw):第 689 行 在 \Source\Workspaces\TestApplications\PrxCustScr\PrxCustScr\Sockets\Listener.cs 中的 PrxCustScr.Sockets.Listener.OnExampleDTOReceived(字符串消息):第 273 行--> 在 System.Windows.Forms.Control.MarshaledInvoke(控制调用者,代表方法,Object[] args,布尔同步) 在 System.Windows.Forms.Control.Invoke(委托方法,对象 [] 参数) 在 \Source\Workspaces\TestApplications\PrxCustScr\PrxCustScr\Sockets\Listener.cs 中的 PrxCustScr.Sockets.Listener.EndTrx(字符串数据,FlowLayoutPanel flw):第 689 行 在 \Source\Workspaces\TestApplications\PrxCustScr\PrxCustScr\Sockets\Listener.cs 中的 PrxCustScr.Sockets.Listener.OnExampleDTOReceived(字符串消息):第 273 行
我该如何解决这个问题?
【问题讨论】:
-
从 cmd.exe 检查客户端和服务器的连接状态 >Netstat -a 将提供端口号列表和连接状态。连接可能正在关闭,因此请检查工作和不工作的时间。
标签: c# sockets event-handling flowlayoutpanel