guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setup a sockaddr


From: Manuel Giraud
Subject: Re: Setup a sockaddr
Date: 06 Aug 2001 12:06:57 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Manuel Giraud <address@hidden> writes:

> Chris Cramer <address@hidden> writes:
> 
> > On Fri, Aug 03, 2001 at 11:13:09AM +0200, Manuel Giraud wrote:
> > > I'm trying to program a simple client/server in Guile as exercise (to
> > > learn how to use socket with it).
> > > 
> > > But, I'm not able to construct a sockaddr object.
> > 
> > What do you need a sockaddr object for exactly? Neither connect or bind
> > need it.
> > 
> 
> Sorry, the previous message wasn't complete, so I'm continuing here.
> 
> I'm using sendto like this:
> 
> (let ((sock (socket AF_INET SOCK_DGRAM 0))
>       (message "coucou")
>       (addr (car (hostent:addr-list (gethost "localhost")))))
>   (sendto sock message AF_INET addr))
> 
> and I get this error: 
> "ERROR: In procedure sendto:
>  ERROR: Wrong type argument in position 5: ()"
> 

I finally correct my problem. The argument at position 5 must be the
port of the service : it was not clear in (help sendto).

Anyway now, it works with only 31 lines: "good guile!"

I'm trying to use 'dynamic-link', 'dynamic-call', etc. For the moment
C functions with args must have a special form, but does anyone knows
if this form will be no more required in next version of guile. For
example to do something like:

        (let* ((dl (dynamic-link "libc.so"))
               (f (dynamic-func "printf" dl)))
          (dynamic-args-call f dl '("coucou\n")))

Hint : consider libc.so as an already written library ;-)

-- 
"Never imagine yourself not to be otherwise than what it might appear
to others that what you were or might have been was not otherwise than
what you had been would have appeared to them to be otherwise"
  The Duchess

_Manuel Giraud_



reply via email to

[Prev in Thread] Current Thread [Next in Thread]