mySocket = new XMLSocket();
mySocket.onConnect = function(success) {
if (success) {
trace("Server connection established!");
} else {
trace("Server connection failed!");
}
};
mySocket.onClose = function() {
trace("Server connection lost");
};
XMLSocket.prototype.onData = function(msg) {
trace(msg);
};
mySocket.connect("1.2.3.4", 1337); // real address omitted here
function sendData() {
trace("sending data");
var theData = "<b>testdata</b>";
mySocket.send(theData);
trace("sent data");
}
[web] Flash XMLSocket disconnection problem
Hi,
I must send some data from Flash to an executable and now I'm trying to do it through a local connection.
I'm trying to connect to a HttpListener made in VB. It detects a connection from browsers when going to the defined adress and port. But when using the only socket I could find i Flash 8, ActionScript 2.0's XMLSocket, it closes the connection right after the send() call and the HttpListener doesn't detect anything so I'm guessing the send call failed (odd way to implement a send function, no callback or return value).
Here's the code I'm using
The sendData() function is called when I press a button. If I stick a getUrl(...) it throws up Explorer and the HttpListener detects it.
Why does the connection get lost?
[Edited by - Seriema on October 19, 2006 7:21:26 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement