我如何将byte []发送到另一台PC [英] how i can send byte[] to other pc

查看:78
本文介绍了我如何将byte []发送到另一台PC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我如何将byte []发送到PC,我知道该PC的IP
现在有办法
任何代码
感谢您的帮助

解决方案

目标PC可能应该知道如何处理接收到的字节,因此目标上有一个应用程序PC,等待字节.您可以将程序设为通过TCP/IP进行通信的目标PC上运行的应用程序.
:)


最简单的方法是使用套接字:因为套接字.发送 [ ^ ]方法被设计为发送字节数组,似乎最好使用.

MSDN [
让我列出您的选项,从低级到高级:

套接字.使用类System.Net.Sockets.Socket.

TCP .在服务器端使用System.Net.Sockets.TcpListener类,在客户端使用System.Net.Sockets.TcpClient类.我会说,这是更好的选择.

远程处理或WCF .请参阅MSDN中的概述和技术示例.

查找示例的最佳方法是在CodeProject文章中进行搜索,下一个是Google.我曾经看过很多非常好的简单样本.对于上面列出的类,这些类的帮助或MSDN页面上有不错的Microsoft示例.这就是为什么从搜索工作的角度来看,使用这些类最容易的原因-几乎没有搜索.远程处理或WCF将需要更多搜索,但是代码可能非常紧凑.在不了解的情况下使用这些技术可能会产生非常不充分的结果.

我真的认为您没有充分的理由让其他人为您进行搜索; CodeProject帮助通常基于查询者的努力.

—SA


hi everyone
how i can send byte[] to pc and i know ip of this pc
there is now way
any code
thanks for any help

Probably the target PC should know what to do with received bytes, hence there is an application, on the target PC, waiting for the bytes. You might make your program an the application running on the target PC communicating via TCP/IP.
:)


The easiest way is to use Sockets: since the Socket.Send[^] method is designed to send a byte array, it seems the best to use.

There is an example on MSDN[^] of how to use.


There is no "send bytes" per se, you need to make service part, ideally, a Windows Service.

Let me list your options, low-level to high level:

Sockets. Use the class System.Net.Sockets.Socket.

TCP. Use the classes System.Net.Sockets.TcpListener in server side, System.Net.Sockets.TcpClient of client side. I would say, this is better option.

Remoting or WCF. See overview and technology samples in MSDN.

Best way to find a sample is a search in CodeProject articles, next one is Google. I used to see a number of really nice simple samples. For the classes listed above, there are nice Microsoft samples in the help or MSDN pages on those classes. This is the reason why using these classes is the easiest from the standpoint of search effort — almost no search. Remoting or WCF will require a lot more search, but the code can be very compact. Using these technologies without understanding can give very inadequate results.

I really think you don''t have a good justification to make other people to do the search for you; CodeProject help is normally based on the effort done by the Inquirer.

—SA


这篇关于我如何将byte []发送到另一台PC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆