是否可以通过套接字从一台计算机向另一台计算机发送一位? [英] Is it possible to send one bit from one computer to another computer through socket?

查看:98
本文介绍了是否可以通过套接字从一台计算机向另一台计算机发送一位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个项目,我必须在其中发送数据。



是否可以通过互联网从一台计算机向另一台计算机发送1位。大多数人都告诉我,最小的互联网数据包大小是64字节。如果我从一台计算机发送1比特到另一台计算机,那么数据包带宽是64字节。

I am working on a project in which i have to send data in bits.

Is it possible to send 1 bit from one computer to another through internet.Most of the people said to me that minimum internet packet size is 64bytes.If i send 1bit from one computer to another then packet bandwidth is 64bytes.

推荐答案

没有这样认为是1位封装,很显然。诀窍是:无论你做什么,你总是创建一些应用层协议 http://msdn.microsoft.com/en-us/library/system.speech.recognition.dictationgrammar.aspx [ ^ ])在您的网络消息中执行您的应用程序语义。所以你可以发送1个字节,但是协议应该说明应该只考虑一个比特。



当然,实际的包将会大得多;如果没有这些开销,你就无法实际发送任何东西。



最后,在实践中,发送微小的数据是一个非常糟糕的主意;当传输的几乎所有信息都在包裹信封中时,这会浪费流量。至于一点,它根本没有任何意义。但是,我知道这是一个测试你的理解的问题。无论如何,这不是一个好的,因为一切都归结为对发送一词的不同理解。



-SA
There is no such think as 1-bit package, quite apparently. The trick is: no matter what you do, you always create some application-layer protocol (http://msdn.microsoft.com/en-us/library/system.speech.recognition.dictationgrammar.aspx[^]) to conduct your application semantic in your network messages. So you can send 1 byte, but the protocol should state that the only one bit should be considered.

And of course, actual package will be much bigger that that; and you cannot physically send anything without this overhead.

Finally, in practice, it''s extremely an bad idea to send tiny bits of data; it''s a waste of traffic, when almost all information transmitted is in the package envelope. As to one bit, it does not make any sense at all. However, I understand that it was a question to test your understanding. Not a good one, anyway, because everything boils down to different understanding of the word "send".

—SA


您已经在互联网数据包大小帮助.....? [ ^ ];如果您有其他信息需要添加,请编辑原文。



但是,正如我在上一个问题中指出的那样,您可以通过套接字发送一个字节。如果该字节只包含1个重要信息,那么这就是您的解决方案。通过线路发送的物理数据包的大小是无关紧要的,并且在套接字级别没有任何意义。
You already posted this question at internet packet size help.....?[^]; if you have additional information to add then please edit the original.

However, as I indicated in the previous question you can send a single byte via a socket. And if that byte only contains 1 significant bit of information then that is your solution. The size of the physical packet that gets sent across the wire is irrelevant and of no significance at the socket level.


你想要做的是类似于使用帖子将微点邮寄给某人办公邮件系统。您通常会将有效负载打包在一个容器中,该容器放入信封中,您可以在其中写入from和to地址。即使您的有效载荷是微观的,您也可以在邮箱中放置其他东西。



您的问题的答案当然是,您可以发送一个位使用套接字,但该位将发送大量填充和信封。
What you want to do is analogous to mailing a microdot to someone using the post office mail system. You would typically package your payload in a container which goes in an envelope, which you write the "from" and "to" addresses on. Even if your payload is microscopic, there are other things you put in the mailbox.

The answer to your question is that, of course, you can send a single bit using a socket, but the bit will be sent with a lot of padding and an envelope.


这篇关于是否可以通过套接字从一台计算机向另一台计算机发送一位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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