string pubcommand = "CHAT|" + clientname +": "+ChatOut.Text + "\r\n";
Byte[] outbytes = System.Text.Encoding.ASCII.GetBytes(pubcommand.ToCharArray());
ns.Write(outbytes,0,outbytes.Length);
ChatOut.Text = "";
--------------------------------------------
Byte[] buffer = new Byte[2048];
ns.Read(buffer,0,buffer.Length);
string chatter = System.Text.Encoding.ASCII.GetString(buffer);
string[] tokens = chatter.Split(new Char[]{'|'});
--------------------------------------------
如果我在发送端采用XML格式,如:
string pubcommand = " <message > <note > " + chat + " </note > <name > " + clientname + " </name > <text > " + chatout.Text + " </text > </message >;
那么在接受端如何解析?麻烦大家根据上面的代码,给个详细说明,谢谢
"
Byte[] outbytes = System.Text.Encoding.ASCII.GetBytes(pubcommand.ToCharArray());
ns.Write(outbytes,0,outbytes.Length);
ChatOut.Text = "";
--------------------------------------------
Byte[] buffer = new Byte[2048];
ns.Read(buffer,0,buffer.Length);
string chatter = System.Text.Encoding.ASCII.GetString(buffer);
string[] tokens = chatter.Split(new Char[]{'|'});
--------------------------------------------
如果我在发送端采用XML格式,如:
string pubcommand = " <message > <note > " + chat + " </note > <name > " + clientname + " </name > <text > " + chatout.Text + " </text > </message >;
那么在接受端如何解析?麻烦大家根据上面的代码,给个详细说明,谢谢
"
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货