开发者

Can I send only byte array with asynchronous Socket class?

开发者 https://www.devze.com 2023-01-08 09:24 出处:网络
I currently work on a server/client program based on asynchronous socket. As far as I see the send() method of the socket 开发者_如何学Pythonclass mainly accept byte buffer. Do I have to convert every

I currently work on a server/client program based on asynchronous socket. As far as I see the send() method of the socket 开发者_如何学Pythonclass mainly accept byte buffer. Do I have to convert everything to byte array or is there any other method?

What should I do to send a simple string for example?


string sendMessage = "This is a clarified example now";
byte[] byteMessage = System.Text.Encoding.ASCII.GetBytes(sendMessage)

Should be all you need. I, for one, am a fan of 30+ character function calls.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号