简体   繁体   中英

C# Polling a TCP Server

Hey everyone - I am wondering if anyone could help me out - I need to poll a TCP server frequently with a request to receive some real-time data.

I know I will need to create a thread in order to talk to the server but I am unsure as to how to make this poll frequently.

Any help would be appreciated...

I would not use a background thread. Rather have a look at a Timer in System.Threading. This is exactly what it was made for. Very easy to use.

使用无休止循环的Backgroundworker或后台线程(有什么区别? ),您将睡眠一段时间(例如1分钟)并轮询数据,该怎么办?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM