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.
精彩评论