关于从端口读取数据
我有一个通过端口发送数据的应用程序。我需要接受数据(在同一系统上),然后将其写入文本文件。现在的问题是我不知道如何去做。
我正在使用 Windows XP。任何能让我接受数据并将其写入文本文件的平台都可以。但最好是 C#.net 平台。
请帮忙。
数据通过网络端口发送。还有没有任何通用的方法来接受数据,因为发送数据的应用程序不是由我开发的,所以我不太确定它将以什么形式发送数据。或者有什么办法可以检查同样的情况吗?
I have an application that sends data over a port. I need to accept the data (on the same system ) and then write it in a text file. Now the problem is that I don't know how to go about doing it.
I am working on Windows XP. And any platform that enables me to accept the data and write it into a text file would do.But preferably C#.net platform.
Please help.
Data is sent over a network port. also is there any generic way to accept data because the application that is sending data has not been developed by me so am not really sure in what form it would be sending the data. Or is there any way to check the same?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是你没有说你喜欢使用哪种端口。但 .Net 框架对于大多数数据流都有某种 <代码>流实现。
串行端口
。套接字
类。FileStream
。
所有这些类都有一些打开、关闭、读取和写入功能。您可以简单地打开两个流,读取第一个流并将输出作为输入放入第二个流中。就是这样。
如果您对更具体的方法不起作用还有任何其他疑问,请随时更新您的问题或提出新问题。
Unfortunately you didn't say what kind of port you like to use. But the .Net framework has for the most of dataflows some kind of
Stream
implementation.SerialPort
.Socket
class.FileStream
.All of these classes have some open, close, read and write functions. And you could simple open two streams, read the first one and put the output as input into the second one. That's it.
If you have any further questions about something more concrete doesn't work, feel free to update your question or ask a new one.