Why?

Frank D. Engel, Jr. fde101 at fjrhome.net
Tue Oct 5 10:10:24 EDT 2004


I just put that into my code, which promptly renders Rev as "frozen" 
when tested.

I did pre-test this type of code by writing it in Ada first, and there 
it works.

According to the docs, read from socket should already be a blocking 
call if no message clause is given.  Is the documentation in error?

Either way, this still is not working.  Could it also be related to the 
binary nature of some of the data?  Should I be using a different 
mechanism to read binary data?

Thank you!

On Oct 5, 2004, at 9:58 AM, Dave Cragg wrote:

>
> On 5 Oct 2004, at 14:37, Frank D. Engel, Jr. wrote:
>
>> Okay, so I got tired of waiting for RevDB to be fixed for PostgreSQL 
>> (or for some explanation of how to set it up, in case my drivers are 
>> not correctly positioned), so I am trying to write my own, 
>> Transcript-native PostgreSQL driver for Rev (with its own API, by 
>> means of a 'start using' command...)  Never tried this before, but I 
>> did get the 'start using' to work.
>>
>> I *think* I was able to get sockets working, too, but for some 
>> reason, at least under OS X, I cannot seem to read from a socket.  
>> What am I doing wrong here?  I have the following handler in my code:
>>
>> function pgFetchMessage
>>   read from socket pg_sock for 5
>>   put it into x
>>   put (charToNum(char 2 of x) * 16777216) + (charToNum(char 3 of x) * 
>> 65536) + (charToNum(char 4 of x) * 256) + charToNum(char 5 of x) \
>>       into l
>>   read from socket pg_sock for l
>>   put it into z
>>   answer charToNum(the first char of x) titled (pg_sock) && (the 
>> length of x)
>>   return (x & z)
>> end pgFetchMessage
>>
>>
>> The "answer" line results in the following title bar (empty message):
>>
>> localhost:5432 0
>>
>> Why would this happen?  That "0" means that the length of string "x" 
>> (which should contain exactly five characters, right?) is zero.  In 
>> other words, that string is empty -- but it shouldn't be!
>>
> It could be that there is no data on the socket when you do the read.  
> You could try replacing the "read from socket pg_sock for 5" with 
> this:
>
> put empty into x
> repeat while length(x) < 5
>   read from socket pg_sock for 5 - length(x)
>   put it after x
> end repeat
>
> Or, use the "with message" form of read, which I find to be more 
> reliable, However, you'd have to change the structure of your handler  
> a little.
>
> Cheers
> Dave
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
-----------------------------------------------------------
Frank D. Engel, Jr.  <fde101 at fjrhome.net>

$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten 
Son, that whosoever believeth in him should not perish, but have 
everlasting life.
$



___________________________________________________________
$0 Web Hosting with up to 120MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com



More information about the use-livecode mailing list