Sign in to follow this  
Seriema

[web] Flash XMLSocket disconnection problem

Recommended Posts

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
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");
}



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]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this