after a whole night of testing I just realized this is normal behavior
basically if the LC engine is doing other stuff it will lump all data together until it has time to call the handler again.
so I have to add a sort of flag to the beginning and end of the data strings so I can process it later
Anyways at least I understand what is non blocking now
as a side note, i ran a test that had an interesting result
I wrote a little piece of code that cycled 2000 times and transmitted a string of 100 characters
on the other machine i wrote some code to receive de data and put it on a field,
the code below get the data and put it in the field
on messagereceivedout pSocket, pMsg
global varMessageline
put pMsg into line varMessageline of field incomingt
put varMessageline + 1 into varMessageline
read from socket pSocket with message "messagereceivedout"
end messagereceivedout
the result was that on the field the 1st line was the 100 characters
and the second line was the remaining 199900
so that means that in the time that live code took to put the information on the field , all the
other data arrived and was put together in pMsg
if I add a "wait 50 millisecond" on the loop that sends the data then it gives plenty of time
to the machine that receives the data to populate the field line by line
the end result is the what I said at the top, I need to add a delimiter to the data streams so I can process
them later.
this is all great news actually, cause it means I don't have to fear data not being read
Tonight am gonna test transferring a big text file "the Bible" from multiple instances at the same time
and put them in text files on the receiving end and then comparing to see if all data is intact
am gonna host the receiving end on a virtual server on the other coast and see the reliability
but so far am very happy with live code and the things it can do
Happy live coding
Non blocking question
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Non blocking question
Hi pistris,
you can also manage the amount of date you want to accept from a socket for one read:
...
read from socket tSox for 100
...
Will read 100 characters from that socket, maybe that will help you, too.
Some hint for speed:
This will cause the engine to count all lines of that field in every run, save some time and maybe just:
Best
Klaus
you can also manage the amount of date you want to accept from a socket for one read:
...
read from socket tSox for 100
...
Will read 100 characters from that socket, maybe that will help you, too.
Some hint for speed:
Code: Select all
on messagereceivedout pSocket, pMsg
global varMessageline
## Get used to put QUOTES around names of objects (and strings in general)
put pMsg into line varMessageline of field "incomingt"
## Save some typing, too :-)
add 1 to varMessageline
read from socket pSocket with message "messagereceivedout"
end messagereceivedout
Code: Select all
on messagereceivedout pSocket, pMsg
put CR & pMsg AFTER field "incomingt"
read from socket pSocket with message "messagereceivedout"
end messagereceivedout
Klaus
Re: Non blocking question
Lol
add 1 to varMessageline
I keep trying to stuff old school
I will try your recommendations tonight and be back with results
thanks Klaus
add 1 to varMessageline
I keep trying to stuff old school

I will try your recommendations tonight and be back with results
thanks Klaus
Re: Non blocking question
Don't feel bad, you are not an anomaly.

Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Non blocking question
All works like a charm
Thanks Klaus for the tip ( read from socket tSox for 100 )
also using ( read from socket tSox until return ) simplifies things
thank you all
Thanks Klaus for the tip ( read from socket tSox for 100 )
also using ( read from socket tSox until return ) simplifies things
thank you all