socket buffer related problem

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
xdriver
Posts: 4
Joined: Thu Mar 31, 2011 11:39 am

socket buffer related problem

Post by xdriver » Mon Apr 18, 2011 10:14 am

Hi,
I'm converting socket reading program written in delphi into livecode using following syntax.

read from socket for read_bytes chars with message 'pkt_read'

When read_bytes is less than 20k there's no delay reading socket data.
But when read_bytes is about 35k the livecode program waits about 5 or more seconds to read socket data.
And at that moment, livecode sends lots of socketTimeout event. I set socketTimeoutInterval to 1000.
And on server side, sending program also waits to flush.
This means livecode program doesn't clear socket buffer after a read.
( I made test delphi program for this. When client doen't read socket buffer, server program waits for some time to flush )

Is there a way to set socket buffer size ?
Or is this a bug which is to be fixed ?

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: socket buffer related problem

Post by bangkok » Mon Apr 18, 2011 10:36 am

A message from 2005, with (apparently) the same issue (LiveCode list)

http://lists.runrev.com/pipermail/use-l ... 52864.html

Which version of LiveCode do you use ?

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: socket buffer related problem

Post by BvG » Mon Apr 18, 2011 12:02 pm

note that socket timeout is sent periodically, and has nothing to do with actual timing out or not. Basically if there's no traffik, socket timeout is to be expected.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: socket buffer related problem

Post by mwieder » Mon Apr 18, 2011 5:00 pm

That's a *very* short timeout interval. You will probably want to increase it to something more than one second. 35k bytes is a lot of packets - no doubt you're hitting timeouts before getting to the end.

xdriver
Posts: 4
Joined: Thu Mar 31, 2011 11:39 am

Re: socket buffer related problem

Post by xdriver » Tue Apr 19, 2011 1:06 am

Thanks for the replies.

I'm using Livecode 4.6.
And I know timeout is natural for socket handleing but in my case it takse to much time to read data.
And in case of delphi program it's a snap to read whole packet.
As I said before, when timeout happens, on server side sending program cannot flush socket buffer becase of client side buffer is not cleared.

Post Reply