Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 02-22-2010, 07:35 AM   #1
edwardkoo
Registered User
 
Join Date: Feb 2010
Posts: 4
Default Binary Socket. When to use DataEvent/ProgressEvent?

Hi,

I am trying to use Flash to connect to a PHP socket server.

Code:
private var FSocket:Socket = new Socket();

FSocket.addEventListener(DataEvent.DATA, SocketOnData);

FSocket.addEventListener(ProgressEvent.SOCKET_DATA, SocketOnResponse);
When should i use DataEvent.DATA? When will DataEvent.DATA being trigger? I know xmlsocket trigger when server response ends with a null char. But it seems for binary socket this event never trigger in my Flash app even if i add a null char at the server response.

ProgressEvent.SOCKET_DATA did trigger in my Flash app but i am worrying that i might not get complete response at the time this event is triggered. Unless i keep process on hold until i receive some kind of end of msg char like null char.
edwardkoo is offline   Reply With Quote
Old 02-22-2010, 12:46 PM   #2
henke37
Senior Member
 
henke37's Avatar
 
Join Date: Mar 2009
Location: Sweden
Posts: 10,863
Send a message via Skype™ to henke37
Default

Yup, TCP sockets are like that, they are stream based, it is up to you to decide when you have recived enough data.
__________________
Signature: I wrote a pair of articles about the timeline.
henke37 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:53 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.