There is no default delimiter in flash.net.Socket. XMLSocket uses a null byte delimiter to detect message completions to fire the ‘data’ and ‘xml’ events. If you are using an XMLSocket Server supporting null bytes. Try adding a null byte before flushing the flash.net.Socket.

 

That should work seamlessly.

 

Also on the receiving side, you will need to read bytesAvailable into a buffer to detect the null byte to denote a message received.

 

Ted J


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of e_baggg
Sent: Thursday, October 19, 2006 8:44 AM
To: [email protected]
Subject: [flexcoders] Socket woes - something simple I'm sure

 

Hello. I have a XMLSocket class that I am able to send/receive data to
no problem.

I switched my implementation to use the flash.net.Socket class and now
I cannot receive data back.

I updated my sendMessage() to the following...this request should
trigger a response from the server but it doesn't...most likely b/c my
request is incorrect. What does the XMLSocket do for me that I am not
doing here? I thought maybe adding the "\n" to the String would work
but it did not. The sendMessage() method is called in my
connectHandler so I know the socket is connected. There are no errors
in my IO and security handlers.

import flash.net.Socket;
public class MySocket extends Socket
{
...
public function sendMessage(xml : XML) : void
{
try
{
var ss : String = xml.toXMLString();
//ss = <credentials user="me" password="pass"/>
this.writeUTF(ss);
this.flush();
trace("Send-->:" + ss);
} catch (error : IOError){
trace("Error: " + error.message);
}
}

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to