背景工人问题.

编程入门 行业动态 更新时间:2024-10-12 03:20:34
本文介绍了背景工人问题.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是WPF的新手 Internet断开连接期间如何保持后台工作线程保持活动状态? 问候, Prabu

Hi, I''m new to WPF How to maintain background worker thread keep Alive during internet disconnect? Regards, Prabu

推荐答案

线程生命周期与Internet连接无关,它一直处于活动状态,直到线程退出其主要方法或中止为止.除非涉及UI,否则它也与WPF无关(请参阅类System.Windows.Threading.Dispatcher). 但是,对于网络通信来说,更好的设计使用一些由其构造函数System.Threading.Thread.Thread创建的永久"线程,请参见 msdn.microsoft/en-us/library/system.threading.thread.aspx [ ^ ]. 您可以在我过去的解决方案中找到一些想法: 在C#和套接字编程中使用api [ ^ ], 来自同一端口号的多个客户端 [ ^ ], 通过服务器触发的自动更新程序 [ ^ ]. 如果这与您的应用程序无关—很抱歉,您没有提供任何详细信息.
—SA
Thread life cycle has nothing to do with internet connection, it is kept alive until the thread exits its main method or is aborted. It also has nothing to do with WPF unless UI is involved (than see the class System.Windows.Threading.Dispatcher). However, for network communications better design uses some "permanent" thread, created by its constructor System.Threading.Thread.Thread, see msdn.microsoft/en-us/library/system.threading.thread.aspx[^]. You can find some ideas in my past solutions: using api in c# and socketprogramming[^], Multple clients from same port Number[^], automatic updater triggered via server[^]. If this is not related to your application — sorry, you did not provide any detail.
—SA

更多推荐

背景工人问题.

本文发布于:2023-11-25 14:52:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1630190.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:工人   背景

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!