First of all, binding is something a server does, and
should not be used unless you are going to listen on a port
for connections. Also, UDP is connectionless, so we don't
want to connect().
Create the socket as you normally would using the socket()
with getprotobyname("udp"), etc. Now, go ahead and call
the send(). Yeah, it is a system call, but NT has the same
system call, used through a WinSOCK library. If it still
doesn't work, your perl package may not be as compatible as
originally thought. But, before jumping to that conclusion,
check your code for every last detail, and rewrite it a
couple of times.
Joe | [reply] |
Okay, that helps a little. It is still not working, but I can tell that I'm closer to knowing why.
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?
Thanks for you help. Any references you have would be wonderful, too.
-Travis
| [reply] |
My reference for now is "UNIX Network Programming, Networking APIs: Sockets and XTI"
by W. Richard Stevens, and published by Prentice Hall.
It tells that the differences between AF and PF are only in
name only, where A means address and P means protocol. The
PF_INET was originally intended to allow for multiple address
families, but was never implemented. If you were to examine
the sockets.h header file, you'll find that the PF_ values
are just assigned to the AF_ values, so which prefix you use
is really just personal preference.
You queried on what is the best "domain" for NT. NT does not
have it's own "domain" in the list. The "domains" were written
on unix, so you have values like "AF_UNIX" for Unix Only protocols,
"AF_ROUTE" for routing sockets, and "AF_LOCAL", which is another
example of Unix Domain Protocols. The only cross platform family
that should be used is AF_INET, which is the Internet's IP,
UDP, and TCP protocols.
Types include SOCK_DGRAM (a UDP only style), SOCK_STREAM (for
TCP sockets), and SOCK_RAW. SOCK_RAW is the most interresting,
because it delivers the IP information to you, rather than the
data from the TCP packet. (This means that you can write ICMP
applications like ping and tracert using a SOCK_RAW to access
the protocol...)
I hope this is helpfull, but not overly detailed (there's nothing
like drinking from a firehydrant...)
Joe Lewis
sharktooth@innocent.com
| [reply] |