Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




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?

Swf Over Xmlsocket
Is it possible to receive a swf or jpg over an XMLSocket?

Thanks,
dege

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 + "" )
if txt == 'terminate ':
terminated = True
channel.close()
Finally to the problem. No matter what I try, I can't seem to get these two applications to communicate when on different machines. When I try it, no messages even get through to python, it doesn't see anything trying to establish a connection. So I suspect it is having a problem on the flash side of things.

Also, is there any way to have multiple flash apps communicating directly, rather than going through the server?

thanks for the help!

XMLSocket
I would like to create an application that connects with XMLSocket to a web URL that I manage, named something like www.bigdomain.com/~mymembername I want to use PHP for the server side. What should I do? I have never worked with sockets, and I could really use some pointers

XmlSocket
Hi,

I'm looking for a flash xmlSocket example chat or any other in flash 8.
Apache is my server on localhost.

I'll appreciate your inputs,

Dhiraj

XMLSocket
hi

i m having c++ file which opens a socket connection for communication with flash and i am having a flash file where i used XMLSocket. where should i keep that c++ file and how to run it and where should i keep the swf file.

please help me

and to use XMLSocket class do i need windows 2000 server .

thanks

regards
palanivel

XMLSocket, Please Help Me
For the past few months i've been trying to get a XMLSocket working on a LAN connection. No matter what I do, I just can't get it to work! Please help me, I need this to make a program I've promised my sister. Either post here or e-mail me at dummyboo@lycos.com. Thanks!

XMLSocket In AS3
poor old lowmoose here is having problems with XLMSocket() in AS3:

http://board.flashkit.com/board/showthread.php?t=736240

me too, i've got very similar problems and reading about the trouble lowmoose had i'm wondering: is XMLSocket in AS3 a bit broken? AS3 is reasonably new and i can't imagine many people will have had experience of using XMLSocket yet so its not out of the question that it might have a few bugs that havenn't been discovered yet.

without going into tremedous detail an application that was sending and receiving multiple asynchonous data thru an xmlsocket in AS2 was working fine. the same app, same code, but in AS3 is not working fine.

can i please ask these two questions

AS3 users: have you had similar problems with XMLSocket in AS3 and if so can you please tell us about them?; and

AS3 developers: are there known issues with XMLSocket in AS3 and if so could you share them with us please?

because i need to decide very quickly about whether i should rollback to AS2 or not.....

thank you! :)

XMLSocket
Does XMLSocket require any specific return codes from the server to maintain a connection. Initially there is no problem connecting and sending data to the server, but once this process completes the connection is dropped or in limbo. Could anyone expand the process.

XMLSocket
hi

do i need windows 2000 server to use XMLSocket class.

i am having a c++ server program using TCP(connection oriented) and a flash file to connect with the c++ program. can i test whether its working or not in local machine itself.

please help me

regards
baskar

XMLSocket
i'm using a php socket server (which is working fine, i tested it already) to make a flash chat. I have gotten my script to recieve stuff from the server, but it can't seem to send it...i'm using

Code:
socket = new XMLSocket();
socket.connect("myserver",port);
socket.send("blah");
I have set up a function to recieve what the server sends...and it just sends back whatever i send it..but when i send my message my flash movie recieve my message back.
Does anyone know if there are any loopholes to the XMLSocket.send, or if i'm doing something wrong?

XMLsocket (how/what ?)
Hi all, Im completely new with socket stuff and I allready did some
googling, but I cannot find an answer (that I understand).

What I try to do is make a RSS reader in flash that plays a sound when the RSS feed is changed.
In an older version I reloaded the xml via a little timer, but what I
understand about this socketthingy is that it keeps an open connection with the server/feed?

Am I correct that this socket parses data (or smth) as soon as the xml
changes ? If yes, why dont this work ? (it does after loading, but
not if the swf is running and the xml is changed)


ActionScript Code:
var xmlTracker:XML = new XML();xmlTracker.ignoreWhite = true;xmlTracker.load("http://www.sitemasters.be/rss/xml/forum.xml");xmlTracker.onData = function(data) {    trace(data);};


Can someone tell me if it really keeps an open connection, and if the data will be updated if the xml changes (and how ?)
TIA

XmlSocket
I have created a php socket server and and flash client after reading the following link.

http://www.kirupa.com/developer/flas...s_flash8_2.htm

Its working in local windows server.But its not working in linux server.
The php socket is running ,client also is running .But its not connecting to the socket.
Is there any thing i have to install or configure in fedora core 4 to run this?

thanks in advance

XMLSocket
i'm using a php socket server (which is working fine, i tested it already) to make a flash chat. I have gotten my script to recieve stuff from the server, but it can't seem to send it...i'm using

Code:
socket = new XMLSocket();
socket.connect("myserver",port);
socket.send("blah");
I have set up a function to recieve what the server sends...and it just sends back whatever i send it..but when i send my message my flash movie recieve my message back.
Does anyone know if there are any loopholes to the XMLSocket.send, or if i'm doing something wrong?

XMLSocket
Hey all, I need your help for this AS

What I need to do is :
- Override the OnData function with my own function.
- Create and connect an XMLSocket object in a GLOBAL variable
- Send the Username
- Send the initial player position (0,0)
- Have a function that sends the new position to the socket when the position has changed.
- And ultimately, close the socket.

Heres what I wrote, please tell me if I have any mistakes and if there's beter ways to do this. Im a total AS n00b....


var Username = "PixelBash";
var IP = "xx.xx.xx.xx";
var Port = "xxxx";
var _global.Position = "0, 0";

_global.socket = new XMLSocket();

XMLSocket.prototype.onData = function (position) {
// Do stuff w/ position
}

_global.socket.connect(IP, Port);
_global.socket.send(Username);
_global.socket.send("0,0");
_global.socket.close();

_global.PlayerMove = function(position)
{
_global.socket.send(position);
}

XMLSocket
I created a tcp server using c that listens on 127.0.0.1 port 5000
I access it succesfully using a flash movie that connects to localhost, or 127.0.0.1. When i move the html that contains the swf on the root of my webserver i created the following crossdomain.xml file in order to access it using http://127.0.0.1/socketgui.html.
<?xml version="1.0"?>
<!-- http://myip/crossdomain.xml -->
<cross-domain-policy>
<allow-access-from domain="*" to-ports="*" />
<allow-access-from domain="localhost" to-ports="*" />
<allow-access-from domain="127.0.0.1" to-ports="*" />
<allow-access-from domain="myip" to-ports="*" />
</cross-domain-policy>
where "myip" is the ip that i see when i go to www.whatismip.com. Using
http://127.0.0.1/socketgui.html or http://"myip"/socketgui.html enables me to see my data. If i try to connect to http://myip/socketgui.html from another explorer remotely i cannot get a connection with the tcpserver.

XMLSocket And Php
Hey,

I'm trying to connect Flash to a Php socket, but am getting a SecurityError: "Security sandbox violation: _ cannot load data from _" (#2048) error back from flash.

In this quick test all I'm trying to do is get php to send back whatever I sent in, ie: the beginnings of a chat program.

first I create a php socket
Code:

// create the master socket
if(!is_resource($master = socket_create(AF_INET, SOCK_STREAM, SOL_TCP))) {
   echo "socket_create() failed: " . socket_strerror(socket_last_error()) . "<br>
";
   exit ;
}

// don't know what this does, but I'm going to lemming it in anyway.
socket_set_option($master, SOL_SOCKET,SO_REUSEADDR, 1);

// bind the socket to an address and port that Flash can access (>=1024)
if(!socket_bind($master, "localhost", 1234)) {
   echo "socket_bind() failed: " . socket_strerror(socket_last_error()) . "<br>
";
   exit ;
}

// tell the socket to listen for incoming calls
if(!socket_listen($master, SOMAXCONN)) {
   echo "socket_listen() failed: " . socket_strerror(socket_last_error()) . "<br>
" ;
   exit ;
}

// create an Array to hold the sockets.
$read_sockets = array($master) ;

then create an infinite loop to look for connections/communications
Code:

while(true) {
   $changed_sockets = $read_sockets ;
   
   foreach($changed_sockets as $socket) {
      
      // someone is trying to make a socket connection.
      if($socket == $master) {
         if(!is_resource($client = socket_accept($master))) {
            echo "socket_accept() failed: " . socket_strerror(socket_last_error()) . "<br>
";
         }
         else {
            array_push($read_sockets, $client) ;
         }
      }
      
      // somebody is trying to tell us something ($message).
      else {
         // grab the information
         if(($bytes = socket_recv($socket, $message, 2048, 0)) === FALSE) {
            echo "socket_recv() failed: " . socket_strerror(socket_last_error()) . "<br>
";
            exit ;
         }

         // if $bytes == 0 then we're going to assume a disconnect command.
         if($bytes == 0) {
            unset($read_sockets[array_search($socket, $read_socket)]);
            socket_close($socket) ;
         }
         
         // otherwise we send the message out to everyone else.
         $count = count($read_sockets) ;
         for($i=1 ; $i<$count ; $i++) {
            socket_write($read_sockets[$i], "$socket wrote: $message");
         }
      }
   }
}


The AS3 so far is just:
Code:

var socket:XMLSocket = new XMLSocket();

socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);

socket.connect("localhost", 1234);


Is there something in my code that is causing this problem? I've taken it straight from tutorials and example files I've found online, and don't really know what I'm doing.

I've got all the files (php, swf, html...) on the same server, in the same folder, so I didn't think I'd have to worry about crossdomain files, sandbox issues, etc... but then I don't really understand server security either, I've always just muddled through.

Thanks,

nic

New To XmlSocket
I was hoping to start a discussion on the finer points of using XMLsocket. Let me describe my project to you. I have 24 XML elements (representing the 24 hours of the day) each with the attribute "avail" or "notAvail". I'm using actionScript 2.0 (but not averse to flash5 syntax.) Basically I was hoping someone would describe the following code to me.
Code to append or modify the attributes of my XML element.

Also your thoughts on a listener object that will reset all attributes to notAvail every day a predetermined time.

Actually any comments on your experiences using the XML object in Flash would be great.
Much thanks!

XMLSocket Problems
Hi everyone, I'm having a problem with a socket connection. The socket is used to retrieve a list of user names from a java servlet. When the connection is made and the users are recieved, the movie clip jumps down have the browser screen. However, this is a problem that is only occurring on two out of the five computers here! Has anyone ever come across this before? I've tried using both the web address and the IP as a parameter in the mySocket.connect() function. Using the IP doesn't seem to make a connection at all, as in mySocket.connect("111.111.11.111", portNo). Thanks for any suggestions.

Heeeelp XMLSocket
Hi !

I am developping a 4 players network card game.

I have a java server that open a socket and a flash client that connect on it, my problem is:

- the java server is hosted by a friend who hosts my website too ...

- when I try my flash client from my HD, the XMLSocket.connect(host,port) works .... when I try it from a webpage It does not...

- I read in the help doc, that if the movie is hosted on the same machine on which the (java) server is, I can specify "null" as the host param of the XMLSocket.connect() function, but that doesn't work too heeeeeeeeeelp (I know nothing about flash and security and perhaps is the source of my problem...)

ps: forgive my english I usually speak french...

Troy

XMLSocket Send
Hi,

I'd really appreciate some help.

I have created a simple socket server, and am trying to communicate with it from within Flash MX.

I create the XMLSocket object, and connection occurs without a problem. The problems occur when I try so send a message. Messages aren't received at the server until I close the socket connection.

Is the XMLSocket buffering the message? Is something else happening?

Does anyone have any ideas how I can overcome this?

Kind regards
Nobleoscar

XMLsocket.connect()
How do I create a port that I can use for connect("gotcool.5penguins.com", port)??? Is it possible to create one? I don't know how to find out which one to use...and testing it isn't an option, because the possibilities are 1024 and up!!!

Question About XMLSocket
hi,

i need to get an event for disconnected user from my site by flash

i need to know where i can find a server for XMLSocket in flash ?

i mean where i have to looking for that Server ?

wich hosts support it ?
is another way to do same with other object ? ( something like global.asa file but not that) .

Xmlsocket And C++ Server
i am trying to develop a c++ server to interact with a flash client through xmlsocket.
they connect successfully.
client sends data to the c++ server sucecssfully.
it's just that the data sent by the server doesn't seem to be terminated with a null character! (or at least one that flash can understand)

i terminated the reply from the server with a "" with "
" with "0" with "00" and nothing worked!

any ideas !

Problem With XMLSocket
It seems I have a really strange problem with this object, as i can't connect to anything no matter which server i try to connect to. The code should be ok:

code:
dataExchange = new XMLSocket();
trace(dataEchange.connect("127.0.0.1", 1337));
stop();


but i always get a undefined in the console even if a c# server is listening on the right port. Using FMX 2k4 pro.
Tried everything from changing the ip adress from 127.0.0.1 to localhost to null but it still doesn't work. Any tip would be greatly appreciated .

[AS2] XMLSocket Question
hi,
I made a class to control the network stuff on my application. Something like:

Code:
class as.cXMLConnection {
var socket:XMLSocket;
var status:String;

function cXMLConnection(){
socket=new XMLSocket();
socket.onConnect = function (success) {
if (success) {
status = "connected";
} else {
}
}
socket.onData = function( sData:String ){
}
}
...
...
}
When the onConnect event is triggered, the status variable is out of scope, so it's not accessible the way I just putted it. Anybody knows how to solve this (without absolute path reference)? I tried with _parent and super but it doesn't worked.

[F8] What Am I Doing Wrong With This XMLSOCKET?
I DO HAVE A SOCKET SERVER RUNNING AT THE TIME.
What is wrong with the script?
I can send stuff to teh server but there is no response.

[F8] Problem With XMLSocket
I have a small chat app and I have some code on the first frame setting up a socket among other things.
What happens is that the socket connects and I can send text to and receive from the socket on the server. This part works just fine.
Here is the code:

Code:
chatSocket = new XMLSocket();
chatSocket.connect("localhost", 6000);
chatSocket.onConnect = function(success) {
if (success) {
chatarea.text += "Server connection established!";
}
else {
chatarea.text += "Server connection failed!";
}
}
function sendMess(mess)
{
if(mess != null || mess != "")
{
chatSocket.send(mess+"
");
}
}

chatSocket.onClose = function() {
chatarea.text += "Server connection lost!";
}

function buttonclick1(evt:Object):Void {
sendMess(chat_in.text);
chatarea.text += chat_in.text;
chat_in.text = "";
}

btnSend.addEventListener("click", buttonclick1);

//this is for any incoming message from the socket
chatSocket.onData = function(msg) {

if(msg.indexOf("S-ADM") != -1)
{
var starray:Array = msg.split(":");
if(starray[1] == "LMT")
{
gotoAndPlay(20);
}
if(starray[1] == "ACC")
{
chatarea.text += "This is the accept button" + "
";
}
}
else
{
chatarea.text += msg;
}

}

The problem is on frame 20 where I want another textarea and two buttons (for both accept and decline options). The one button simply sends the String "ACCEPT" to the server. What actually happens when I press the button is that it appears to return to the first frame and run all that code again (I know this for sure as a result of several well placed trace functions).
Here is the code for frame 20:

Code:

req_alert.text = "There is an incoming alert";
btnAcc.onRelease = function()
{
chatSocket.send("ACCEPT" + "
");
}
stop();

How can I send data through the socket without having to run all of frame 1 again? (btw - I also have the chatSocket.send in another function and tried it that way and I get the same results)
Thanks in advance.

XMLSocket Server
HI!

I'm Looking for wais of implementing a XMLSocket server on IIS.

Anyone knows what can I do?

XMLSocket Problem
Hey Guys,

I got a problem with the XMLSocket. Since now I managed to fix all problems but now there is a problem where I really have no clue !
I have a flash application and this Flash Application connects with on Port 1506 to a Server. When testing everything works fine but when I publish the File and test it on my local Apache Server the connection fails. I know: "You must set the settings to 'Network only' " I tried but till doesn't work. At the same time I use sendAndLoad (LoadVars) but this doesn't work either. But when I set the Flash Settings to "Local only" the sendAndLoad Function works but the XMLSocket still doesn't work. Please help me Guys, this is driving me crazy !!!

Ben

XMLSocket And LoadPolicyFile
Writing an XMLSocket based flash client and socket server app - all is running - have figured out crossdomain issues - all (finally!) working great...

HOWEVER:
I think repeated calls to System.security.loadPolicyFile with the same uri ("xmlsocket//blah:x" during an install process to detect the socket server running) are not working for us - my only theory is that the first call is cached internally - and subsequent calls to loadPolicyFile with the same uri are ignored.

Can anyone confirm? My tests with a tcpip monitor seem to confirm... though i could just be dead wrong anyway. I have tried appending "/" + getTime() to the uri to trick flash into not caching, but no luck. Any theories welcome...

XMLSocket Allow Connect Thru WAN?
i would like to use XML socket to connect between client and server. if the client ans server not located in LAN, but need to connect thru internet, XML Socket can do it??

thank you for answering me...

XMLSocket.connect
I have been having some really odd issues when it comes to flash connecting to my socket server. It tends to run perfectly fine when I test my movie in flash and even when i open the swf with internet explorer. HOWEVER, when i upload the swf, it just wont connect!!! I can sit there for days and it just wont connect. Anyone have any ideas as to why it will connect when it is on a users computer but not while its on the server??

XMLSocket Characteristics
Hi, i have several problems with flash XMLSocket.
It seems, that XMLSocket.send() is ending each packet with a [hex: 00]. I find this unsuitable for me, because server is expecting me to end a packet with a
.

Also, the server is sending me packets back - guess what - ended with a
, which, as far as I understood, doesn't trigger XMLSocket.onData(), right?

Is there a way bypassing/fixing/cheating these problems?
Thanks in advance.

XmlSocket / OnData
Like many others before me, I am having problems with the xmlSocket object and specifically with the onData event not firing.

Object defined thus:


Code:
myXML = new XMLSocket;
myXML.onConnect = handleConnect;
myXML.onClose = handleDisconnect;
myXML.onData = handleData;
myXML.connect("localhost", 9090);

function handleData() {
trace("data");
}
(I left out the other functions but they are defined).

My socket server is set up to send back a simple welcome message when a client connects. Using Telnet I can connect and get the welcome message back. In Flash I connect and nothing... or at least onData doesn't fire.

Checking the log my server generates tells me it is sending the message to Flash.

I've read the past posts on this subject and it seems everyone says something along the lines of "the string needs to be terminated by a null byte" and in my server (written in PHP) I've tried "", chr(0) and nothing (assuming that if PHP uses a null byte to end a string anyway I don't need to add one) and Flash still doesn't seem to respond to the incoming data.

Am I missing something obvious? Can anyone help at all?

thanks.

Something Is Wrong With XMLsocket
alright , I am using XMLsocket class, actrionscript 2.0 (flash 8). I have set up appache server on port 1024, and I can connect without problems. But something's wrong with sending test data (I am using log file to check for incoming server requests) the code is this:

quote:
var theSocket:XMLSocket = new XMLSocket();

theSocket.connect("localhost", 1024);

theSocket.onConnect = function(myStatus) {
if (myStatus) {
TraceTxt("connection successful");
} else {
TraceTxt("no connection made");
}
};

theSocket.onClose = function () {
trace("Connection to server lost.");
}

function sendData() {
var myXML:XML = new XML();
var mySend = myXML.createElement("thenode");
mySend.attributes.myData = "someData";
myXML.appendChild(mySend);

theSocket.send(myXML);
TraceTxt("I am trying to send: " + myXML);

}

sendButton.onRelease = function() {
sendData();
};

theSocket.onData = function(msg:String):Void {
trace(msg);
};

function TraceTxt(strMessage:String)
{
dtxMessage.text = dtxMessage.text + strMessage + "
";
}

XMLSocket Issue
I am working on a client/server application. The server is written in Java, and the client is written in Flash. Up until now, I have had the client and server running on separate machines, but I would now like to run them on the same machine. This seems like it would be simple, but I am having issues. Here is my configuration:

192.168.0.186 - machine where Flash client has been running
192.168.0.199 - machine where Java server has been running

I now want to run both on 192.168.0.186. I have the Java server up and running on this machine, but the SWF fails to connect. I have tried all three of the following for connection addresses: 127.0.0.1, localhost, 192.168.0.186. None of them work.

When the client is on 192.168.0.186, it can connect to the server on 192.168.0.199 just fine.
If I try running the client on 192.168.0.199, it can connect to the server on 192.168.0.186.

I can also telnet directly to the server on 192.168.0.186 from itself.

I can also run both the client and server on 192.168.0.199.

Does anyone have any idea what could be causing this particular case to fail? It seems very strange that I would be able to successfully connect to a server on a REMOTE machine, but not the local machine.

Thanks in advance.

XMLSocket Vs. The Enter Key
Hi forum,

I came across a strange problem with a function that makes use of a XMLSocket. The function just connects the socket; after that the socket's events should handle the connection. Now I have a textfield for user input (just a name), and a "connect" button. The 'connect' function is assigned to the button and also to the enter key, via a KeyListener.
Now the function works fine when triggered by the button, it connects, the server responds, the response is handled. When triggered by the enter key, it connects, the server sends the response, but this doesn't seem to reach the socket. The socket stays connected to the server, but is just idle, and it can't be used to send anything. Only when the movie is closed, all sended input reaches the server at once, until that, it just stays that way.
The server's response gets traced in Flash, but it only comes up when the button was used to connect. Somehow the enter key must screw something up, or why is the response not appearing? The server log says it got sent...

Any ideas on this?

thx,
blemmo

About XMLSocket Reconnection
hello: I got a question about XMLSocket. The problem is this: if the connection is established to the server then it is done. if the connection is not successfully established then it will retry the connection 10 seconds later.

here is my code:

class .... {

....

public function Connect():Void {
var _isConnected:Boolean = _conn.connect(_hostIP, _hostPort);
_conn.onConnect = function(_isConnected:Boolean):Void {
if (_isConnected) {
_conn.send("Hello there.");
// MessageModule();
} else {
trace("No connection.");
// Wait(); ???
// Reconnect(); ???
}
}
}

...
}

in my code I try to send "Hello there if it succeeds" while I still can't figure out how can I implement the //Wait() and //reconnect part. please give me some help. Thanks!!!!!

XMLSocket And Proxies
Dear friends,
We have a project based on TCP connections between Flash client - using XMLSocket class - and a TCP server.
We have a major problem and that is the XMLSocket class may not connect to the server ifthe Flash is running in a network which connects to internet thru some proxy and not directly.

Any suggestion to work arround it is highly appreciated.

Thank you

XMLSocket Not Reconnecting
Hi, I have an AS3.0 script that uses an XMLSocket to establish a connection.

Everything is fine except that XMLSocket.connect() won't reconnect to
the host. Not after it fails at least once.

Once I call XMLSocket.connect() on a host/port pair, if the call fails
(there's no way to check that but after 10 seconds, say, I assume it
fails) then I can never connect to the same host/port pair ever again.

Not if I call close() (which will throw an error unless you call
connect() successfully again), not if I drop the event handlers and
recreate the socket, not ever. connect() will do nothing if called with
that same host/port pair.

It's as if Flash has a host/port/status table where it marks a host as
'down' after 3 connection attempts (connect() sends 3 SYN packets).

The only solution I've found so far is to reload the .swf, which is
unacceptable.

Any ideas?

Copyright © 2005-08 www.BigResource.com, All rights reserved