Reading from data from socket does not work on MacOS X

Brian Yennie briany at qldlearning.com
Wed Apr 6 21:17:58 EDT 2005


Mark,

What happens if you change:

on connected theIP thePort
   read from socket theIP with message "readSocket"
end connected

To

on connected theIP thePort
   read from socket theIP for 1 line with message "readSocket"
end connected

?

I believe there are some platform differences involving open-ended 
reads. You should be able to get the exact amount to read by doing 
measured reads, checking the content-length of the POST, and then 
reading for that number of bytes past the HTTP headers.

Something like, in pseudo code:

read until (cr&cr) -- end of the headers
find content-length header -- should read "Content-Length: 387" or 
something like that
read for the content length
display content

HTH,

Brian

> Alex,
>
> Obviously, you're right. I copied the connected and readSocket handler 
> and added the foo handler later. Anyway, with or without message 
> "connected", it doesn't work. Any ideas?
>
> Mark
>
>
> Alex Tweedly wrote:
>> Mark Schonewille wrote:
>>> Hello,
>>>
>>> I am trying to create a server that handles POST actions from web 
>>> forms. Rather than using cgi, I read the socket and handle the 
>>> request. If the request contains the data from the web form, it is 
>>> written to a file. This works fine if the server is running MacOS 9, 
>>> but not on MacOS X.
>>>
>>> The test script is fairly simple:
>>>
>>> on foo
>>>   accept connections on port 8181
>>>   -- may test for result
>>> end foo
>>>
>> Shouldn't that be
>>   accept connections on port 8181 with message "connected"
>> (Though I have no clue why that would work on OS9 and not on OS X  
>> ..... I'm hoping you made a  typo in copying)
>
> -- 
>
> eHUG coordinator
> mailto:europe at ehug.info
> fax: +1 501 633 94 04
> http://home.wanadoo.nl/mark.sch
> http://www.ehug.info
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>



More information about the use-livecode mailing list