Adobe Dreamweaver Forums



Last 10 THreads :         datagrid in a datagrid (Last Post : nickname118 - Replies : 4 - Views : 7 )           »          special chars in XML (Last Post : ilux - Replies : 0 - Views : 1 )           »          TextArea: Interface for user selection is deficient (Last Post : ericbelair - Replies : 2 - Views : 3 )           »          Lost resorce on Adobe.com (Last Post : tweaked_eye - Replies : 1 - Views : 2 )           »          Mail form not working (Last Post : Murray *ACE* - Replies : 3 - Views : 4 )           »          Discussion Forum liability issues (Last Post : bregent - Replies : 1 - Views : 2 )           »          need check of site in IE7 please. (Last Post : yankeestonk - Replies : 6 - Views : 7 )           »          WYSIWYG HTML Editor compatible with Toolkit (Last Post : simon_r2d2 - Replies : 0 - Views : 1 )           »          Please help...Need to rotate image/MC by moving mouse (Last Post : FunkyGibber - Replies : 1 - Views : 2 )           »          getURL no longer working - used to! (Last Post : Rick_Cope - Replies : 2 - Views : 7 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Flex
 
Tags: , ,



Reply
  #1 (permalink)  
Old 08-11-2008, 05:47 PM
tiaan.wessels
 
Posts: n/a
Diggs:
Default Concurrent Socket Traffic

I have an application connected to an IPCBUS over which it receives events at
unpredictable intervals. My app also has various GUI elements allowing the user
to interact with a backend RPC server. Every now-and-then I find the response
to an RPC messed up and from tracing it would seem to coincide with incoming
traffic from the bus. The two pieces of data is non-related and carried over
different socket connections. My question is whether flex is supposed to handle
this gracefully or is it documented somewhere that you are allowed to have
traffic on a single socket at any one time. Of course the two aspects uses
different callback functions to handle their data and everything is heavily
based on extending the EventDispatcher class.



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-11-2008, 06:21 PM
jkhgdkhgslkj
 
Posts: n/a
Diggs:
Default Re: Concurrent Socket Traffic

I haven't yet tried doing network programming in Flash, but as a longtime
Winsock/sockets programmer, this smells to me like a bug in your code. It's
common for new network programmers to misunderstand how TCP/IP works, thus
causing problems when they try to use it.

The most important thing to understand is that TCP is a stream
protocol. There are no packets in TCP, at the application level. If the
remote host makes three "send" calls, one with 50 bytes, the next with 100, and
the next with 150, your program can receive all 300 bytes in a single receive
call, or one byte at a time in 300 separate receives, or anything in between.
How those bytes are packetized over the wire is, effectively, totally outside
your application's control, due to optimizations in TCP like the Nagle and
delayed-ACK algorithms. If there is anything smarter than a switch between the
two hosts, things can get even crazier.

So, if you're expecting a "packet" from the server, you need to somehow be
able to know when you've received the whole thing. The two common ways of
doing that are length-prefixing and delimiting.

An example of length-prefixing is to always send 2 bytes at the start of every
packet with the length of that packet, as a binary number. Beware when doing
this that different machine types have different byte orders for integers at
the binary level. You need to agree on a standard. Or, you can limit yourself
to 256-byte packets by sending just a single byte length prefix, and avoid the
mess.

An example of delimiting is to put some special byte or group of bytes between
packets that never occurs in regular data. A lot of the Internet protocols do
this, with linefeed characters.

And then there are the protocols like HTTP that do both: the header lines are
delimited with linefeeds, and then you have an optional block of content
following the headers, whose size is declared in the Content-Length header in a
form of length prefixing.

If you know all this, and you're sure you've done it right, post some code so
we can offer more than general advice, as I've done.

Reply With Quote
  #3 (permalink)  
Old 08-12-2008, 07:04 AM
tiaan.wessels
 
Posts: n/a
Diggs:
Default Re: Concurrent Socket Traffic

Thanks for the long reply. I am fortunately not new to network programming
(you'll even find a patch to the linux kernel x25 stack under my name if you
dig hard enough - sorry, seems as though I need to establish credentials).

I inherited a large flex application when a person left our company and am
currently trying to fix some intermittent networking related problems in the
program. After a couple of days debugging now it is starting to seem to me as
if the flash runtime mixes up network traffic when dispatching events but from
experience I have learnt not to question the compiler or tools but rather your
own program. Therefore the first thing and really the crux of my question is:
is there no documented limitation somewhere in the 3000+ pages of
flex/actionscript documentation stating that you are only allowed communication
on a single socket at any one time. If there is no such limitation and no
documented bug in the flash runtime then I know I should dig deeper.

It is unfortunately impossible for me to upload example code as this is
thousands of lines of code to illustrate the problem so I think all I need
answered is the question regarding any documented limitations on concurrent
socket communications if there is a flex network programming expert out there
perhaps reading this.

thanks

Reply With Quote


  #4 (permalink)  
Old 08-20-2008, 03:21 AM
Carrollmuliganu Carrollmuliganu is offline
Junior Member
 
Join Date: Aug 2008
Posts: 1
Diggs: 0
Post I'm new here!

Hi there!
My first post at this great forum!
I wanna show u my dayly updated blog: How to choose good credit card
Have a nice day!
BB!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 05:03 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk