C interface or oztool problem (sp. libcurl)

Fredrick Paul Eisele fred at netarx.com
Thu Jul 28 22:40:15 CEST 2005


Denys Duchier wrote:
<snip/>

>
>There is no way we can help you without seeing the code.
>
>You have set yourself a very difficult task for your first foray into the world
>of Mozart/Oz native functor design.  IO is quite difficult to do right: you
>don't want to ever block (or the whole system would block)
>
Ok, I'll take another whack at a dead horse...
We had a bug for a released module that has this very problem.
http://www.mozart-oz.org/pipermail/mozart-hackers/2003/001265.html

I posted a bug report that is still sitting in 'incoming'.
http://www.mozart-oz.org/cgi-bin/oz-bugs/incoming?id=1438

I wrote a MEP (not a very good one I guess).
This seems like a significant (dare I say major) bug.
Why so little interest?

> and you don't want an
>Oz thread that just polls.  I can coach you on how to do it right, but it's a
>bit of a rough ride :-/
>
>Cheers,
>
>  
>
And the sample code.

functor

 import
  Application
  OS
  Property
  System

define
  MySocket
  InputHeader
  InputTrailer

 in

  {Property.put 'print.width' 1000}
  {Property.put 'print.depth' 1000}

  MySocket = {OS.socket 'PF_INET' 'SOCK_STREAM' 'tcp'}
  try
    {OS.connect MySocket '10.0.0.3' 21}
  catch E then
    {System.show 'Exception: '#E}
    {Application.exit 0}
  end
%  {OS.connectNonblocking MySocket '10.0.0.3' 21}

  {OS.read MySocket 1024 InputHeader nil _}
  {System.show 'InputHeader'#InputHeader}

  {System.show 'Sending QUIT'}
  {OS.write MySocket "QUIT\n" _}

  {OS.read MySocket 1024 InputTrailer nil _}
  {System.show 'InputTrailer'#InputTrailer}

  {System.show 'Closing Socket'}
  {OS.close MySocket}

  {Application.exit 0}

end


-------------- next part --------------
A non-text attachment was scrubbed...
Name: unix.cc
Type: text/x-c++src
Size: 5934 bytes
Desc: not available
Url : http://lists.gforge.info.ucl.ac.be/pipermail/mozart-hackers/attachments/20050728/504dd923/unix.bin


More information about the mozart-hackers mailing list