# XML Socket Problem

**URL:** <https://forum.kirupa.com/t/xml-socket-problem/244403>\
**Category:** flash\
**Created:** [November 17, 2007, 1:35pm UTC](https://forum.kirupa.com/t/xml-socket-problem/244403 "2007-11-17T13:35:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![True\_Believer](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@True\_Believer](https://forum.kirupa.com/u/True_Believer)\
**Post date:** [November 17, 2007, 1:35pm UTC](https://forum.kirupa.com/t/xml-socket-problem/244403/1 "2007-11-17T13:35:18Z")

</div>

Hi guys can someone help me with this I’ve been looking at it for a while now and can’t see where I’m going wrong. All I need to do is get my file to connect to the socket but when I try it nothing happens I don’t even get the failed to connect to socket message. If someone can spot where I’m going wrong I would be most grateful. I know the server side code is correct so it has to be my actionscript.

```auto

import mx.transitions.easing.*;
import mx.transitions.Tween;

// Create a new XMLSocket
var ClientSock = new XMLSocket();

// THe onConnect function is an event handler fired when the XMLSocket attempts to connect to the remote server
ClientSock.onConnect = function(success)
{
    if ( success )
    {
        trace("Successfully Connected to socket");
        
    }
    else
    {
        trace("Failed to connect to socket");
    }
}

//Fuction sends message when connection is closed.
ClientSock.onClose = function()
{
    trace("<b>Server connection lost</b>");
}
// This function handles XML messages and is fired with the flash application recieves and XML message from the server, the paramater 'doc' is the XML document
ClientSock.onXML = function(doc)
{
    trace("Recieved following XML from Server");
    trace( doc.toString());
}

// Example of function that sends XML message to remote server
function Test()
{
    msg = new XML();
    msgdata = msg.createElement("Admin");
    msgdata.attributes.Command = "debug";
    msg.appendChild( msgdata );
    ClientSock.send( msg );
    
}

// Ensure socket is closed first
ClientSock.Close();
// Connect to remote Server
ClientSock.connect("82.109.164.188", 12345 );

```

Thanks in advance.
