Re: [flexcoders] Cant receive socket data
hmmm. I could easily append some bytes and see what happens, but not 'til Monday when I go back to work. Thanks! Maciek Sakrejda wrote: Interesting. We ran into this issue with URLStream: http://bugs.adobe.com/jira/browse/FP-748 -- maybe your problem is related? Actually, searching Adobe JIRA for XMLSocket turns up a number of bugs that sound vaguely like what you're experiencing... -Maciek
[flexcoders] Cant receive socket data
I have a Flex 3.0 app which can connect to a remote socket server, and send it XML, but nothing happens ( no event fires, no error in debugger) in Flex when the server returns data. The remote server is appending a nullbyte to the xml message, and thinks its sending the data. Ideas? - the server code ( perl) snippet: my $NULLBYTE = pack( 'c', 0 ); if ( $1 eq new ) { print STDOUT request is: $1 sending xml data\n; print CONNSOCK $simdata ; print CONNSOCK $NULLBYTE; } the flex code snippet: | var socket:XMLSocket = *new *XMLSocket(); socket.addEventListener(Event.CONNECT, connected); socket.addEventListener(DataEvent.DATA, dataReceived); socket.connect(localhost, 8989); *private function *connected(event:Event):*void* { socket.send(xmldata); } *private function *dataReceived(dataEvent:DataEvent):*void* { trace(dataEvent.data); var xml:XML = *new *XML(dataEvent.data); } Thanks John |
Re: [flexcoders] Cant receive socket data
yikes, please ignore extraneous asterisks in snippet. this is corrected: - the server code ( perl) snippet: my $NULLBYTE = pack( 'c', 0 ); if ( $1 eq new ) { print STDOUT request is: $1 sending xml data\n; print CONNSOCK $simdata ; print CONNSOCK $NULLBYTE; } the flex code snippet: var socket:XMLSocket = new XMLSocket(); socket.addEventListener(Event.CONNECT, connected); socket.addEventListener(DataEvent.DATA, dataReceived); socket.connect(localhost, 8989); private function connected(event:Event):void { socket.send(xmldata); } private function dataReceived(dataEvent:DataEvent):void { trace(dataEvent.data); var xml:XML = new XML(dataEvent.data); } Thanks
RE: [flexcoders] Cant receive socket data
You are an optimist: you are not listening for flash.events.IOErrorEvent.IO_ERROR or flash.events.SecurityErrorEvent.SECURITY_ERROR from the XMLSocket. -Original Message- From: flexcoders@yahoogroups.com on behalf of john fisher Sent: Thu 4/9/2009 2:11 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Cant receive socket data yikes, please ignore extraneous asterisks in snippet. this is corrected: - the server code ( perl) snippet: my $NULLBYTE = pack( 'c', 0 ); if ( $1 eq new ) { print STDOUT request is: $1 sending xml data\n; print CONNSOCK $simdata ; print CONNSOCK $NULLBYTE; } the flex code snippet: var socket:XMLSocket = new XMLSocket(); socket.addEventListener(Event.CONNECT, connected); socket.addEventListener(DataEvent.DATA, dataReceived); socket.connect(localhost, 8989); private function connected(event:Event):void { socket.send(xmldata); } private function dataReceived(dataEvent:DataEvent):void { trace(dataEvent.data); var xml:XML = new XML(dataEvent.data); } Thanks winmail.dat
Re: [flexcoders] Cant receive socket data
Thanks - but I added this code and no change. The events don't fire. socket = new XMLSocket(); configureListeners(socket); 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); } etc etc etc copied from http://livedocs.adobe.com/flex/3/langref/flash/net/XMLSocket.html#includeExamplesSummary Maciek Sakrejda wrote: You are an optimist: you are not listening for flash.events.IOErrorEvent.IO_ERROR or flash.events.SecurityErrorEvent.SECURITY_ERROR from the XMLSocket.
Re: [flexcoders] Cant receive socket data
More debugging: If I send connect, request data (a short XML text which the server is looking for), then connect again, The data comes through. Note: I am watching in a packet sniffer and I never see the policy file come across any port, though I am able to connect. Note2: if I remove the nullbyte from the perl code no data ever appears. -puzzled John
RE: [flexcoders] Cant receive socket data
Interesting. We ran into this issue with URLStream: http://bugs.adobe.com/jira/browse/FP-748 -- maybe your problem is related? Actually, searching Adobe JIRA for XMLSocket turns up a number of bugs that sound vaguely like what you're experiencing... -Maciek -Original Message- From: flexcoders@yahoogroups.com on behalf of john fisher Sent: Thu 4/9/2009 4:05 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Cant receive socket data More debugging: If I send connect, request data (a short XML text which the server is looking for), then connect again, The data comes through. Note: I am watching in a packet sniffer and I never see the policy file come across any port, though I am able to connect. Note2: if I remove the nullbyte from the perl code no data ever appears. -puzzled John