Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to work UDP in NT, and I've gotten some great help so far.

In the socket() function, the four parameters are handle, domain, type, and protocol. I understand handle as a handle. I can name it what I please so long as I refer to it consitently. Type in this case is datagram (SOCK_DGRAM). Protocol is the results of the getprotobyname() call. And that I think I have all correct.

What is domain? What is PF_INET, AF_INET, et al. What would be the domain setting for NT and why?

Thanks for you help. Any references you have would be wonderful, too.

-Travis

Replies are listed 'Best First'.
Re: What is Domain?
by btrott (Parson) on Mar 02, 2000 at 01:10 UTC
    You should be using either PF_INET or AF_INET. Here's a short note about the difference, which seems to be relatively negligible, in practice. Use PF_INET, since that's what used in perlman:perlipc, I guess. In general, though, they have the same value, so it doesn't really matter.

    And you're using INET instead of UNIX (like AF_UNIX) because you want internet-domain sockets (INET), not Unix-domain sockets (UNIX).

    Take a look at perlman:perlipc for more details, particularly the "UDP: Message Passing" section.