本文介绍了C#套接字没有定时器或while循环接收的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我是c#中socket编程的新手。目前我正在开发Windows应用程序套接字。即我有一个c#windows应用程序,其中我想读取数据来每隔100毫秒插入插座

并在文本框中显示该数据。



我已经使用socket.receive方法通过使用计时器轮询来实现它。但是通过在Windows应用程序中使用计时器,它会挂起一段时间或只是数据延迟。



我想知道c#中有任何方法我可以当新数据到达时读取套接字.plz建议用一些例子。

Hi all
I am very newbie to socket programming in c#. Currently i am working on Windows Application socket receive. i.e I havea c# windows application in which i want to read data comming to socket
every 100ms and display that data in text box.

I had implemented that using socket.receive method by polling it using a timer. But by using a timer in windows Application it hangs some time or just data comes delayed.

I want to know that is there any method in c# by which i can just read the socket when new data arrives.plz suggest with some example.

推荐答案


这篇关于C#套接字没有定时器或while循环接收的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 16:07