Socket read problems

Dar Scott dsc at swcp.com
Fri Oct 8 12:45:33 EDT 2010


On Oct 8, 2010, at 5:29 AM, Len Morgan wrote:

> I wish it was that simple but the length of the message is only in  
> one byte so it's pretty hard to swap.

Yeah, I guess the high byte is always zero.

I never use read by number of bytes.  It is not that I have seen  
problems with it, I just became comfortable doing things another way.

I usually use 'read from <socket> with message <callback>'.  I don't  
think the 'with message' is important for the behavior I see.  This  
reads whatever is in the buffer.  I think some people use an idiom of  
"for 0" in the command for this.

I collect bytes into a buffer until there is a whole message and then  
pull that off, in a sense, doing myself what you are looking for  
LiveCode to do.

You might be able to use 'read from <socket>' as a way to prevent the  
timeouts and to diagnose the problem.  This will show if there are  
problems with the frame length.

Dar Scott





--
**************************************
Dar Scott
Dar Scott Consulting  and  darzLAB
8637 Horacio Place NE
Albuquerque, NM 87111

Lab, office, home:  +1 505 299 9497
Fax:                try 299-9497
Skype/Google:       lets set up a time

http://www.swcp.com/dsc
dsc at swcp.com

Computer programming and tinkering
**************************************






More information about the use-livecode mailing list