开发者

Can I send only byte array with asynchronous Socket class?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜