[英]TCP socket and binary data
How to send binary data (01110110 for exemple) with C# throught a TCP (using SSL) socket ? 如何通过TCP(使用SSL)套接字通过C#发送二进制数据(例如01110110)?
I'm using : 我正在使用 :
SslStream.Write()
and 和
h[0] = (byte)Convert.ToByte("01110110");
isn't working 没用
You need to be a little clearer about what 01110110
is. 您需要更加清楚
01110110
是什么。 Is it decimal? 是十进制吗? Hex?
十六进制? Binary?
二进制? Note that "binary data" can be represented in any base.
注意,“二进制数据”可以以任何基数表示。
Since it's 8 digits of 0 and 1, and since you used the word "binary" in your question, I'm going to guess that it's binary, which is 118
decimal (google for 0b0111010 in decimal
). 由于它是由0和1组成的8位数字,并且由于您在问题中使用了“二进制”一词,因此我猜它是二进制的,即
118
十进制(Google表示0b0111010 in decimal
)。
So you can just do 所以你可以做
h[0] = 118;
My feeling is that you'll need to learn a bit more about the basics of how bytes work and the binary system before you'll be able to make much further progress. 我的感觉是,您需要进一步了解字节工作原理和二进制系统,然后才能取得更大的进步。 A good beginning programming book should help.
一本好的入门编程书籍应该会有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.