XMLSocket Class

My Flex Application is using XMLSocketClass for communicating
with Webserver. But connection cannot be established. I am not
getting any error message.
I am using the follwing code for establishing the connection:
=================================================================
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="vertical">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.collections.ArrayCollection;
import flash.net.Socket;
private var socket:XMLSocket;
private function connectToServer():void
socket = new flash.net.XMLSocket();
socket.connect("71.222.34.91", 8002);
function sendData()
var xmlvalue:String=txtData.text.toString()
var
xmlfile:String="<command>GetRevision</command>"
socket.send(xmlfile);
private function getData()
socket.addEventListener(DataEvent.DATA, onData);
private function onData(event:DataEvent):void {
trace("[" + event.type + "] " + event.data);
]]>
</mx:Script>
<mx:HBox width="80%" horizontalAlign="center">
<mx:TextInput id="txtData" name=""/>
<mx:Button id="btnConnect" label="Connect"
click="connectToServer();btnConnect.enabled = false"/>
<mx:Button id="btnSend" label="Send Data"
click="sendData()"/>
<mx:Button label="getData" id="btnGet"
click="getData()"/>
</mx:HBox>
</mx:Application>
====================================================================
Please help me to handle this error.

Oops! We forgot to sent the server app's EOL and EOF byte
stream. Without them the server app was simply caching the data
until such a byte stream was received.

Similar Messages

  • Extending XMLSocket class

    I'm using Flash MX 2004. I want to write a class that extends
    XMLSocket and provides a little more information. For instance, I
    want *my* socket class to have a property that indicates whether
    the socket is connected or not and I want the Boolean value of
    'connected' to be set when the socket's onConnect event triggers.
    How do I modify/capture the super class's events? Perhaps someone
    can recommend how I might change my class:

    Hi,-
    i have a question regarding extending a class.
    what is wrong with the following statement?
    sub_class a = (sub_class) class.method();
    sub_class is an extension of class.
    thanks,
    barisI'm afraid without any actual code, all I can say is that you tried to cast the reference that method returned to something that it is not a subclass of. This is per the docs for ClassCastException which say, in part:
    (your) code has attempted to cast an object to a subclass of which it is not an instance.

  • 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 + "\n";

    Hello Alana,
    Do these songs/tracks sound okay in iTunes?  Have you tried resetting your iPod to see if that makes a difference?  To do this, press and hold both the Select (Center) and Menu buttons together until the Apple logo appears. 
    I would also try a different set of headphones/earbuds to see if that makes a difference as well.
    And if the problem still continues, try restoring your iPod via iTunes and reloading all your music back over to it.
    The last you may want to consider doing, if nothing from above resolves the issue is to rerip these tracks into iTunes.  Try importing them in a different format or at a different bit rate to see if that makes a difference.
    B-rock

  • XMLSocket onData Issue

    I am trying to narrow down a bug in an application that
    utilizes the XMLSocket class. I have reduced it to the following
    code below. Is there such a scenario that practically simultaneous
    messages sent from a server would cause 'false' to be traced more
    than once (ie. can the code in the onData method evaluate test as
    false more than once because onData is called a second time before
    the first onData method has had time to update test to true)? Can
    the onData method be treated as atomic? To a certain degree....?
    At the root of this question, I am trying to grasp how
    asynchronous calls are handled/queued to make sure I understand
    them correctly and prevent certain cases where a single-time
    operation may occur twice. If any one can help or direct me to
    information regarding this, I would be very thankful.
    Dan

    Hi Tracy,
    Thanks for your reply.
    SocketComm is a action script class which maintains XMLSocket
    object for the whole application.
    package asclasses
    import flash.display.Sprite;
    import flash.events.*;
    import flash.net.XMLSocket;
    import mx.controls.Alert;
    public class SocketComm extends Sprite
    private var hostName:String = "localhost";
    private var port:uint = 8080;
    private var socket:XMLSocket;
    public function createSocketConnection(hostName:String,
    port:uint):XMLSocket {
    if(socket == null) {
    socket = new XMLSocket();
    socket.connect(hostName, port);
    }else if(socket != null && !socket.connected) {
    socket.connect(hostName, port);
    return socket;
    Actually now i am able to communicate with server over
    XMLSocket.
    There was some problem at server side.
    But still i am not comfortable with using
    SocketComm(XMLSocket) as a common utility class due to event based
    asynchronus model. Like in Java Socket all calls are synchronus, I
    can easily create common class for socket communication.
    But due to my unfamiliarity with event based asynchrous model
    of programming, I am facing difficulties.
    Like my requirement is to use SocketComm class as a
    communication medium with server for various business operations
    like add, modify and delete etc. from various Flex UI screens. But
    due to event based model, I am not really sure how and when socket
    is going to send response.
    So if you look at my first post, I have added all listeners
    to mxml page but i feel this is not a good design, As i have
    atleast 4-5 mxml pages where in I will repeat these listeners.
    I would really appreciate if you could provide me some
    guidance on using SocketComm class as a effective common class.
    Thanks in advance :)
    Regards
    Tarun

  • Is there a way to flush an XMLSocket?

    Flash Media Server 2 provides an XMLSocket class. The
    XMLSocket.send() method does not immediately send the data passed
    to it. Is there any way to flush an XMLSocket and force it to send
    the data that it has?
    I have an application that needs to send very small XML
    objects to another process. The XML objects need to be sent right
    away. The XMLSocket in the Flash Media Server 2 seems to buffer the
    data. I have tried both the XMLSocket and the XMLStream classes.
    Neither sends the data right away.
    Any suggestions?

    Also the G1.NomadISP likes to boot weaker connections quite frequently, and often ignore the first internet reuqest.

  • How to do a Flash chat on my website

    hi im new pls forgive my foolishness, but can you please tell
    me how to contruct a flash chat room for my site, i want to be able
    to talk to a lot of people with out them being able to talk to each
    other, so maybe something like meebo.com, which opens up lots of
    different windows with in the website. thanks

    hi,
    if you know actionscript then use xmlsocket class as it makes
    it smooth for developing chat application in flash. you can google
    and find an answer to it. you can also refer to macromedia press's
    training from the source book. it has a project on it.
    gaurav

  • How to upload a zoomify image to my website

    I have a project where I need to upload, to my own website, a photo exported from PS using zoomify.
    I have a folder with the name "test_img", containing:
    image properties,
    "test_img.html",
    folders of tile groups,
    and the zoomifyViewer.
    I also have a single "test_html" file (separate from the other folder).
    Which of these folders do I need to link to if I put it on my website? I just want to create a separate link for a group of people who are in this photo, I don't want to have the image as part of my main portfolio, it's just a stand alone thing...?
    Appreciate any help!
    Thanks,
    Alan.

    hi,
    if you know actionscript then use xmlsocket class as it makes
    it smooth for developing chat application in flash. you can google
    and find an answer to it. you can also refer to macromedia press's
    training from the source book. it has a project on it.
    gaurav

  • How to get Total Number of XML Nodes?

    Hello All,
    I have a Flash program I'm doing in Actionscript 3, using CS6.
    I'm using the XMLSocket Class to read-in XML Data. I will write some sample XML Data that is being sent to the Flash
    program below...
    I know with this line here (below) I can access the 4th "element or node" of that XML Data.
         Accessing XML Nodes/Elements:
    // *I created an XML Variable called xml, and "e.data" contains ALL the XML Data
    var xml:XML = XML(e.data);
    // Accessing the 4th element of the data:
    xml.MESSAGE[3].@VAR;          --->     "loggedOutUsers"
    xml.MESSAGE[3].@TEXT;         --->     "15"
         SAMPLE XML DATA:
         <FRAME>
    0               <MESSAGE VAR="screen2Display" TEXT="FRAME_1"/>
    1               <MESSAGE VAR="numUsers" TEXT="27"/>
    2               <MESSAGE VAR="loggedInUsers" TEXT="12"/>
    3               <MESSAGE VAR="loggedOutUsers" TEXT="15"/>
    4               <MESSAGE VAR="admins" TEXT="2"/>
         </FRAME>
    I'm new to Flash and Actionscript but I'm very familiar with other languages and how arrays work and such, and I know for
    example, in a Shell Script to get the total number of elements in an array called "myArray" I would write something like
    this --> ${#myArray[@]}. And since processing the XML Data looks an awful lot like an array I figured there was maybe
    some way of accessing the total number of "elements/nodes" in the XML Data...?
    Any thoughts would be much appreciated!
    Thanks in Advance,
    Matt

    Hey vamsibatu, thanks again for the quick reply!
    Ohhh, ok I gotcha. That makes more sense.
    So I just tried this loop below and I guess I could use this and just keep assigning an int variable to the output so
    when it finishes I will be left with a variable containing the total number of elements:
    for (var x:int in xml.MESSAGE)
         trace("x == " + x);
    *Which OUTPUTS the Following:
    x == 0
    x == 1
    x == 2
    x == 3
    x == 4
    So I guess I could do something like this and when the loop completes I will be left with the total number of elements/nodes...
    var myTotal:int;
    for (var x:int in xml.MESSAGE)
        myTotal = x;
    // add '1' to myTotal since the XML Data is zero-based:
    myTotal += 1;
    trace("myTotal == " + myTotal);
    *Which Prints:
    "myTotal == 5"
    Thanks again for you suggestions, much appreciated!
    I think that should be good enough for what I needed. Thanks...
    Thanks Again,
    Matt

  • Live stream switching

    hi!
    I have a problem. I want to set up a live streaming experience, where streams will be switched live by a server side application written in .NET. The flash clients will have no control over what stream they want to watch.the setup is such: video streams from two cameras are encoded in Live Encoder. FMS should stream only a single stream to the clients and which stream should be shown should be chosen by a .NET application
    How do I go about accomplishing such a task? As I understand the FMS uses RTMP to communicate with clients. Are there any other ways to contact the FMS and tell it to switch between two streams, i.e. an XMLSocket connection? This would be perfect since it would integrate with the .NET server perfectly. I do not like the prospect of using RTMP to contact the FMS and tell it to switch between streams. Is it even possible, or can the stream switching be performed only per client?

    You can use an XML socket, but the FMS application will need to initiate the connection, as FMS has no support for listening for anything other than RTMP and HTTP requests.
    Stream switching can happen on the FMS side. In your FMS application, you'll create a server side stream, and use the Stream.play method for playing other sources (live streams or recorded flv/h.264 files) over that stream. Your subscribers will connect to the server side stream
    See the FMS docs for the Stream class and the XMLSocket class.

  • Flex caching policy files in error?

    Hello,
    I am using the XMLSocket() class to send and receive XML content from a java socket program.  If I start the flex applicaion before the java app comes online then I get a SecurityErrorEvent.SECURITY_ERROR - which is OK.  But I have retry logic in Flex such that it will continue to try and connect (I am using a timer to retry).  Trouble is that once I start the java applicaion I still get the same SECURITY_ERROR, even when the socket and policy file are available.
    So it would seem that Flex is caching the URL of my XMLSocket() with no policy file, because when it first tryed to load the policy file there was no response.  And it never tries to load the policy file again.  Even if I try to force it with the Security.loadPolicyFile call it still wont pick it up.
    My java program returns the policy file from the XMLSocket directly.  Also it seems that if I stop the java program after flex has made the initial connection then the Flex applicaion can recover (so it seems that it is very importaint that flex have the policy file available the first time it is requested, as it gets cached for the life of the Flex runtime thereafter).
    Seems like a bug to me...  I can work arround this by ensuring the initial connection is OK before I let the user into the applicaion, but I would think Flex could fix this.

    I had to uninstall all of FLEX and the cfeclipse items
    including cleaning out the registry (PC) then reinstall. it is such
    a shame because cfeclipse is a very nice plug-in, I hate having
    another window for my CF editing.

  • Xml server, requests push, event notifications

    Hello,
    I can only work with oracle via Flash ActionScript xmlSocket, thus
    there is a pure xml communication so I need the following:
    1) tcp/ip xml server (connection port for Flash ActionScript XmlSocket class)
    2) server push - ability to send N requests at once with later responses fetching
    3) ability to add event listener on every DB change and the option
    to receive the notifiction event back to client as xml document.
    4) persistant connection for multiple xml requests and responses during
    one connection.
    Does Oracle support all this, or at least 1), 3), 4) ?
    Thanks, Dmitry

    Dmitry,
    From what I read: I think you need a socket server. UNITY 2.0 (java based), Shovemedia (java based), Swocket (open source built in Python)
    If you use Python:
    The below link has information on python cx_oracle connection to the database in cx_Oracle.connect('userid/password@database')
    Python: http://www.ioug.org/python.pdf
    Alernative external data with Flash Remote
    http://www.devarticles.com/c/a/Flash/Working-with-external-data-in-Flash/

  • Can storing a live stream using actionscript fail by the cache filling up with overhead?

    Hi,
    Lately we have been seeing a problem with the archives of live streams we create using FMS. We use FMS for live streaming and concurrently store the stream in a file using ActionScript. We use the following code to record:
    var s2 = Stream.get('mp4:' + mp4name);
    application.publishedStreamMP4= s2;
    application.publishedStreamMP4.record();
    application.publishedStreamMP4.play(application.publishedStream.name,-1,-1);
    (some lines have been removed that are used for logging, etc).
    Sometimes some of these functions fail and return false. In these cases FMS's core log shows that the cache is full:
    2013-06-11 11:45:55        13863   (w)2611372      The FLV segment cache is full.  -
    In investigating this issue I have not yet been able to recreate this exact situation. By lowering the cache to 1MB I have however been able to create a situation where storing a stream can stop because the cache is full. The situation occurs as follows:
    * The server is restarted, the cache is empty.
    * A live stream is started, which is also recorded.
    * Via the Administration API the cache values <bytes> and <bytes_inuse> show to be exactly the same as the <overhead> of the object that relates to the file being saved. The <bytes> and <bytes_inuse> values of the object are 0.
    * This continues in the same way untill the cache is full.
    * When the limit of the cache is reached the message
    2013-06-11 12:07:35        13863   (w)2611372      The FLV segment cache is full.  -
    is shown in the core log and storing of the file stops. The instance log also show status changes:
    2013-06-11 12:07:35        13863   (s)2641173      MP4 recording status for livestream.mp4: Code: NetStream.Record.NoAccess Level: status Details:         -
    2013-06-11 12:07:35        13863   (s)2641173      MP4 recording status for livestream.mp4: Code: NetStream.Record.Stop Level: status Details:     -
    In the filesystem I can confirm that the last change of the file is on this moment (in this case 12:07). The live stream continues without problems.
    I have reproduced this several times. Though I can understand that caches can fill up and this can cause trouble I feel like this situation is a bug in FMS. The cache fills up with overhead, which is apparently reserved untill writing the file ends.
    I hope someone here can help out. Has anyone seen a situation like this and is there any remedy for it? Or even a workaround where this overhead in the cache can be released so the cache does not fill up?
    We use FMS version 4.5.1.

    You can use an XML socket, but the FMS application will need to initiate the connection, as FMS has no support for listening for anything other than RTMP and HTTP requests.
    Stream switching can happen on the FMS side. In your FMS application, you'll create a server side stream, and use the Stream.play method for playing other sources (live streams or recorded flv/h.264 files) over that stream. Your subscribers will connect to the server side stream
    See the FMS docs for the Stream class and the XMLSocket class.

  • Controllo winsock vsXMLSocket

    Salve a tutti!il mio problema è il seguente:
    Ho realizzato un server in visual basic 5 che utilizza il
    protocollo TCP/IP del metodo winsock.
    Il client ( in flash ) si collega a questo server utilizzando
    la classe XMLSocket.
    La connessione viene stabilita,riesco ad inviare i dati dal
    flash al server ma non riesco ad inviare i dati dal server al
    client ( i dati vengono inviati perchè ho fatto una prova
    creando un client in visual basic ).
    Questo è il codice che utilizzo:
    Socket=new XMLSocket();
    Socket.connect("localhost",2000);
    Socket.onData=function(msg:String):Void{
    trace("sono arrivati i dati");};
    I dati che invio hanno il seguente formato:
    "comando1◄comando2◄comandox"
    Il ◄ è un separatore.
    Qualcuno mi può aiutare? Sto impazzendo...
    Saluti da Samuel e Simona.

    I'm sorry.I'll write in english this time :D
    Hi everyone!
    I've got this problem:
    I've done a server coded in visual basic 5.0 that uses TCP/IP
    protocol with winsock method.
    The client (done with flash) connects to this server using
    XMLSocket class.
    I can connect to the server with this client, i can send data
    from flash to visual basic but i can't send data from visual basic
    to flash!Data is sent from the server....i'm sure of this the
    because i've done a little client in visual basic and receivers
    data.
    This is part of the code in actionscript (where i think is
    the mistake):
    Socket=new XMLSocket();
    Socket.connect("localhost",2000);
    Socket.onData=function(msg:String):Void{
    trace("data has arrived");};
    Data sent from the server have this format:
    "command1◄command2◄commandx"
    The ◄ char is just a separator i use to elaborate the
    string.Even with a 0 char at the end,client won't the receive
    anything....
    I'm freaking out!Someone help me please!!!

  • 1131:Packages must not be nested

    Hai all,
    I m working on a Flex Application, in which I have to
    communicate with the server through TCP Socket. I am using
    XMLSocketClass. I got a code from help, but I am getting
    "1131:Packages must not be nested" error whenever I m trying to
    compile it. Pls tell me the reason for this error.
    ==========================================================================
    XMLSocketExample.as
    ==========================================================================
    package //ERROR// 1131:Packages must not be Nested
    import flash.display.Sprite;
    import flash.events.*;
    import flash.net.XMLSocket;
    public class XMLSocketExample extends Sprite {
    private var hostName:String = "localhost";
    private var port:uint = 8080;
    private var socket:XMLSocket;
    public function XMLSocketExample() {
    socket = new XMLSocket();
    configureListeners(socket);
    socket.connect(hostName, port);
    public function send(data:Object):void {
    socket.send(data);
    private function
    configureListeners(dispatcher:IEventDispatcher):void {
    dispatcher.addEventListener(Event.CLOSE, closeHandler);
    dispatcher.addEventListener(Event.CONNECT, connectHandler);
    dispatcher.addEventListener(DataEvent.DATA, dataHandler);
    dispatcher.addEventListener(IOErrorEvent.IO_ERROR,
    ioErrorHandler);
    dispatcher.addEventListener(ProgressEvent.PROGRESS,
    progressHandler);
    dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
    securityErrorHandler);
    private function closeHandler(event:Event):void {
    trace("closeHandler: " + event);
    private function connectHandler(event:Event):void {
    trace("connectHandler: " + event);
    private function dataHandler(event:DataEvent):void {
    trace("dataHandler: " + event);
    private function ioErrorHandler(event:IOErrorEvent):void {
    trace("ioErrorHandler: " + event);
    private function progressHandler(event:ProgressEvent):void {
    trace("progressHandler loaded:" + event.bytesLoaded + "
    total: " + event.bytesTotal);
    private function
    securityErrorHandler(event:SecurityErrorEvent):void {
    trace("securityErrorHandler: " + event);
    ============================================================================
    Flex File
    ============================================================================
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Script source="XMLSocketExample.as"/>
    <mx:Button x="202" y="140" label="Button" id="sendButton"
    name="sendButton" />
    <mx:Label x="204" y="110" id="conn_txt"
    enabled="true"/>
    </mx:Application>

    Hi, Thanks for your help. I added the follwoing code in my
    Flex Application.
    <mx:Script>
    <![CDATA[
    private var aa:<ClassName> = new <ClassName>();
    ]]>
    </mx:Script>
    Thanks. No I am facing one more problem. I can't receive any
    reply messages from the server, when I am trying to get some
    responses through TCP Socket using XMLSocket Class.
    addEventListener(DataEvent.DATA, dataHandler) is not working.. I
    have posted the problem in the forum. Can u pls go through that??
    Thanks in advance,
    Sunil NaIR

  • Streaming Server, Interactive Server, Development Server - can I get some clarification please?

    I've read the Flash Media Server 3.5 developer's guide and
    have perused various parts of the 3.5 Server-Side language
    reference, and now I am confused as to what functionality is
    available to which server products.
    For example, the XMLSocket class says its available to the
    "Flash Media Server 2". The name of the streaming server product is
    "Flash Media Streaming Server" and the other server product is the
    "Flash Media Interactive Server". So does that mean XMLSocket is
    applicable to both?
    Elsewhere in the language reference, the Netstream.time is
    said to be available to the "Flash Media Interactive Server" and
    the "Flash Media Development Server". OK, the first one is pretty
    clear, but I don't see anywhere on the Adobe site for the "Flash
    Media Development Server". Is that the "Flash Media Streaming
    Server" that Adobe allows to be downloaded for development? If
    that's the case, then shouldn't Netstream.time also be available
    for the "Flash Media Streaming Server"? In any case, this
    functionality seems pretty crucial to writing applications for
    streaming, why would it not be available?
    What I'm gettting at is that I'm trying to determine which
    server products our company needs for the project we are embarking
    on. The project is paid live streaming that authenticates a user,
    keeps track of his time viewing live streams, keeps track of which
    live stream he views, disconnects them when they run out of paid
    time, sends a message to them that they have run out of time, and
    shows them their time as it is ticking down.
    Can someone please clarify on the server components
    needed?

    If you want live streaming, authentication, and server side
    application logic, you want FMIS (interactive server).
    The development server has all the features of FMIS enabled
    but a limit of 10 connections. (eula is also different)

Maybe you are looking for

  • Unable to Copy File From Terminal Server to Client Share

    Hi For years client have been able to copy files from our Windows 2003 Terminal Server to their local workstation using: copy myfile \\tsclient\mydrive\myfolder However we upgraded to Windows 2012 Server R2 and now Windows 7 Pro clients cannot copy f

  • Sending a pdf with mail that is directly seen by opening the mail?possible?

    hello, I want to send a pdf by Mail but I would like the receiver to click on my email and that he/she will see the complete pdf immediately. is that possible? thanks Hein

  • Mail files on server and webmail view don't match

    Hi there, First-time poster... sorry if this has been addressed ad infinitum. We are running Msging Server 6.2-6.01 (according to 'imsimta version'). I have a problem with a user's account. The account has a mailQuota of 20Mb, of which about 89% is c

  • Switch conditionals

    Hello all i'm working on a homework assignment in where we created a match game.  It's up to me to figure out how to tell the action script which difficulty the user play the game at.  There are 3 buttons easy, mediym, hard.  Each one lays out an inc

  • Basic Question: How does serialization handle multiple references?

    Hello, I am not entirely sure how serialiazation works. class Employee implements Serializable { // properties and stuff here class Company implements Serializable { public ArrayList allPeople = new ArrayList(); // this holds a bunch of Employee obje