简单问题高分悬赏(flash+c#)
我做了一个实时数据接受,数据发送成功后,flash接收不到数据
on (release) {
var listener = new XMLSocket();
listener.connect("192.168.1.16", 1025);
listener.onConnect = onSockConnect;
listener.onClose = onSockClose;
listener.onXML = listonXML;
listener.send("hello");
function onSockConnect(success) {
if (success) {
Error = "success";
} else {
Error = "faild";
}
}
function onSockClose() {
Error = "Close";
}
function listonXML(doc) {
var e = doc.firstChild;
if (e != null && e.nodeName == "axis") {
data1 = e.attributes.name;
}
}
}
数据发送程序为
private void Send_Click(object sender, System.EventArgs e)
{
IPAddress ip=IPAddress.Parse(IP.Text.Trim());
IPEndPoint ep=new IPEndPoint(ip,Convert.ToInt32(Port.Text));
Socket soc=new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
try
{
soc.Connect(ep);
string data="<axis name=\""+textBox1.Text.Trim()+"\"/>";
data+="\0";
byte[] bytes=Encoding.ASCII.GetBytes(data);
soc.Send(bytes);
soc.Close();
Error.Text="发送成功";
}
catch(Exception ee)
{
Error.Text=ee.ToString();
}
}