Again About Xmlsocket
is it possible for flash to send something like this?
<byte><byte><byte><byte><byte><XMLcontent> huynhnhatminh: <XMLcontent>=<textbyte><textbyte>...
where byte is a char....
FlashKit > Flash Help > Flash ActionScript
Posted on: 12-14-2005, 04:06 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
XMLSocket
HI, im getting a weird behaviour of XMLSocket I have this app we are making to get a connection between a socket server and Flash, and it works well but we tried using it inside of Internet Explorer and it wont give signs of trying to connect to the server... Why would this happen?
Code:
terra = new XMLSocket();
_root.datos += "Initialized Terra Object" + chr(13);
terra.connect("tdnet.myftp.org", 13361)
_root.datos += "Connecting..." + chr(13);
terra.onConnect = function(success) {
_root.datos += "Connection: " + success + chr(13)
}
terra.onData = function(data) {
_root.datos += data;
_root.terminal.text = _root.datos
_root.terminal.scroll= 100
}
terra.onClose = function() {
_root.datos += "Connection: Closed" + chr(13)
}
I would be very glad if u helped me
XMLsocket
hi there,
shortly: i need to use xmlsocket in flash, but i don't know how exactly does it works. and i cannot find any tutorial or something like that. can you please help me?
greetings...
XMLSocket API Help Please
Dear FlashKit experts...
I am banging my head against the wall with a particular XMLSocket problem... I am attempting to connect to a Servlet or PHP script on my local machine, send a brief message, and read the response in Flash using XMLSocket. I am positive the Server is set up correctly, as I can successfully connect to both the Servlet and PHP script via other means and receive the correct response. The problem really has to be what I am doing in ActionScript.
In AS, I am able to connect ( the onConnect call back function is called back with a success boolean parameter ), but my onData call back method is never called!!! I am sure that I am connecting and sending the data ok, cuz I have my Servlet logging each hit and each hit's request message. this is all cool. However, my onData callback is never called!!!! what am i doing wrong?!?!?
Here's the code:
var host:String = "127.0.0.1";
var port:Number = 8080;
var uri:String = "/jyserv/RPC2";
var msg:String = "Hello from Flash";
var sock:XMLSocket = new XMLSocket();
sock.onData = function (src:String):Void {
trace("message received");
};
sock.connect(host,port);
sock.onConnect = function (myStatus) {
if (myStatus)
trace("Connected!!!")
else
trace("Connection failed");
};
var req:String = "POST " + uri + " HTTP/1.0
" +
"Host: 127.0.0.1
" +
"Connection: close
" +
"User-Agent: AS ZAPI client
" +
"Content-Type: text/xml
" +
"Content-Length: " + msg.length +
"
" +
msg + "
";
sock.send(req);
XMLSocket() Help
I have created a simple chat program that uses XMLSocket() to communicate with the server. I have an XML server installed on my local computer since I couldn't find a free one to host it on. The program works fine on my computer and all of my friends computers(connecting to mine over the internet) until I upload it onto my site. The HTML and .swf files are both exactly the same, but it won't connect after I upload them. I have an onConnect event on the socket that returns false when it is uploaded but true before I upload it. My computer is not receiving any request or anything for a connection when it is online.
I'm using Flash MX. Any ideas?
XMLSocket
can someone tell me some info about XMLSocket
when a swf with XMLSocket code in it is server from a website to a users browser
which is it that attempts to send through the socket
a port is opened on the web server
or
a port is opened on the clients machine
?
XMLSocket With PHP
Hello
I need somebody to tell me how to create a page in php that uses sockets to interact with flash (with XMLSocket). PHP code sample would be appreciated.
Thanks in advancne,
zach_297
XOR & XMLSocket
I am wondering if data encrypted with XOR in flash can be passed to the server with XMLSocket.
XMLSocket
Hello
I have a bit of an issue. I am working on an app with JAVA & AS3. The app functions as an SMS gateway where message are filtered then qued to tcp in XML. Now the front-end has to be published in 7...not in 8 or 9. Therefore, in the shell or front-end I need to open a port by tcp and pull the xml. I felt the most efficient approach would be to create an XMLSocket. With this the shell is connecting and opening the port successfully, but when I attempt to pull the data my traces seem to be server configs(linux). Now my question is, is the XMLSocket the correct solution. Moreover, if not any ideas to how to open the tcp port and parse the xml? Here is the connection code that I am currently working with.
Thanks in advanced.
Ron
var theSocket:XMLSocket = new XMLSocket();
theSocket.connect('localhost', port);
// displays text regarding connection
theSocket.onConnect = function(success) {
if (success) {
conn_txt.text = "connection successful";
} else {
conn_txt.text = "no connection made";
}
};
theSocket.onClose = function () {
conn_txt.text = "Connection to server lost.";
};
XMLSocket.prototype.onData = function (src) {
theSocket.onXML(new XML(src));
};
theSocket.onXML = function (doc) {
var e = doc.firstChild;
if (e == null && e.nodeName == "moderation") {
trace(e.attributes.moderation + " :nickname")
}
};
XMLSocket From .swf
I can use XMLSocket fine when I publish in Flash... everything works great.
But when i run the .swf or through the html it doesn't connect.
Why oh why... is there some security setting i have to change.
XmlSocket
I've been searching a long time to find a way to do multiplayer in flash. I came across xmlSocket. I'm trying it out really simple at first:
Code:
Security.loadPolicyFile('http://www.smileyunlimited.com/crossdomain.xml');
_root.onEnterFrame = function() {
sendXML("num "+sockMessagesRecieved);
};
sockMessagesRecieved = 0;
myXML = new XMLSocket();
myXML.onConnect = handleConnect;
myXML.onData = handleData;
myXML.onClose = handleDisconnect;
myXML.connect("192.168.1.101",2950);
function handleConnect(connectionStatus) { //display on screen if it connected or not.
if (connectionStatus) {
_root.connection.text = 'connected';
} else {
_root.connection.text = 'failed';
}
}
function handleData(xmlObject) {
sockMessagesRecieved++;
}
function sendXML(textToSend) {
myXML.send(textToSend);
}
function handleDisconnect() {
trace("Connection lost.");
myXML.connect("192.168.1.101",2950);
}
I've gotten all the policy stuff working. And this works perfectly while testing on my computer. If you're wondering, I have a python script listening on port 2950. Here's the python code:
Code:
import socket
mySocket = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
mySocket.bind ( ( '192.168.1.101', 2950 ) )
mySocket.listen ( 5 )
while True:
channel, details = mySocket.accept()
print 'We have opened a connection with', details
terminated = False
while not terminated:
txt = channel.recv (22)
print txt
if (txt == '<policy-file-request/>'): #if flash requests a policy file, send it!
channel.send('<?xml version="1.0"?><!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd"><cross-domain-policy><site-control permitted-cross-domain-policies="master-only"/><allow-access-from domain="*" to-ports="*" /></cross-domain-policy> ')
channel.close()
terminated = True
else:
channel.send ( "echo: " + txt + " |