[#3006] mismatched quotation — "stevan apter" <apter@...>

ruby documentation uses a punctuation convention i've never seen

13 messages 2000/05/27

[ruby-talk:02974] Re: Socket.getnameinfo

From: Dave Thomas <Dave@...>
Date: 2000-05-25 06:53:58 UTC
List: ruby-talk #2974
ts <decoux@moulon.inra.fr> writes:

> D> Does anyone know how to specify the port to Socket.getnameinfo?
> 
>  what is your version of libc ?

It's 2.1.1-4

> D>         require 'socket'
> D>         p Socket.getnameinfo(["AF_INET", 23, 'www.ibm.com'])
> 
>  glibc-2.1.2
> 
>   if (service && service[0])
>     {
>       char *c;
>       gaih_service.name = service;
>       gaih_service.num = strtoul (gaih_service.name, &c, 10);
>       if (*c)
>         gaih_service.num = -1;
>       else
>         /* Can't specify a numerical socket unless a protocol family was
>            given. */
>         if (hints->ai_socktype == 0)
>           return EAI_SERVICE;
>       pservice = &gaih_service;
>     }

OK - now I'm confused even more. Is this implying I need to pass a
port number in as a string? I tried that, but got

        require 'socket'
        p Socket.getnameinfo(["AF_INET", '23', 'www.ibm.com'])

        -:2:in `getnameinfo': no implicit conversion from string (TypeError)
	  from -:2


I've also tried it with a protocol family, not an address family

        require 'socket'
        p Socket.getnameinfo(['PF_INET', 23, 'www.ibm.com'])


All to no avail.

So, how dumb _am_ I being?


Dave


In This Thread