# Flash XML Socket + CF Socket Gateway

**URL:** <https://forum.kirupa.com/t/flash-xml-socket-cf-socket-gateway/196156>\
**Category:** programming\
**Created:** [August 6, 2006, 3:17am UTC](https://forum.kirupa.com/t/flash-xml-socket-cf-socket-gateway/196156 "2006-08-06T03:17:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tfoston](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/tfoston/32/2516_2.png) [@tfoston](https://forum.kirupa.com/u/tfoston)\
**Post date:** [August 6, 2006, 3:17am UTC](https://forum.kirupa.com/t/flash-xml-socket-cf-socket-gateway/196156/1 "2006-08-06T03:17:05Z")

</div>

I’m using the Flash XML socket class to hook up to a CF server. On CF side I’ve configured the Socket Eventgateway with a listener CFC with the following code I riped from the adobe site

\<cfcomponent displayname=“echo” hint=“echo messages from the event gateway”\>  
\<cffunction name=“onIncomingMessage” output=“no”\>  
\<cfargument name=“CFEvent” type=“struct” required=“yes”\>

```
  &lt;!--- Create a return structure that contains the message. ---&gt;
  

  &lt;cfset retValue = structNew()&gt;
  &lt;cfset retValue.DestinationID = arguments.CFEvent.OriginatorID&gt;
  &lt;cfset retValue.MESSAGE = "Echo: " & arguments.CFEvent.Data.MESSAGE&gt;
  

          &lt;!--- Send the return message back. ---&gt;
        &lt;cfset Flash.Result = retValue&gt;
  &lt;cfreturn Flash.Result&gt;

```

\</cffunction\>  
\</cfcomponent\>

this is suppose to send the info that the user sends right back to flash, but it doesn’t. Instead in the cf administrator, i’m getting a message that says

Here is what I have on the Flash side

Cannot send outgoing message. OriginatorID ‘32921119’ is not a valid socket id. The number itself is made by the CF server. So my question is. CAN SOMEONE PLEASE HELP!!!  
everytime i run the swf i get a new socket id number so its always changing.

Here is what i have on the flash side

//call the function to get the username, set the result to a global variable to use elsewhere

var username = “Mr.Pointy Haired Boss”  
var mysck:XMLSocket = new XMLSocket() //new xmlsocket object  
mysck.connect(“192.168.1.100”,4445) //connection to socket server

mysck.onConnect = function(success){  
if(success){  
trace(“The connection has been made”)  
}  
else{  
trace(“The connection has failed”)  
}  
}  
send\_mc.onRelease = function(){  
var mystr:String = “\<message\>\<sender\>”+username+"\</sender\>\<body\>"+input\_txt.text+"\</body\>\</message\>"  
var myxml:XML = new XML(mystr)  
trace(myxml)

```
mysck.send(myxml)

```

}  
mysck.onData = function(data){  
message\_txt.text = data  
}

I’m seding the message as a string with an xml format. I’ve been reading up on this non stop and i feel clueless  
.
