Hi, On Wednesday, Sep 17, 2003, at 07:00 Europe/Berlin, darwin-kernel-request@lists.apple.com wrote: I can understand your struggle. I don't find the 'sosocket()' call anywhere in the xnu source base. Are you sure you have that right? Sorry, my bad. I meant sosend(), as written in the subject. A) Using in-the-kernel calls like this is risky, in that there is no guarantee that the semantics of the call will remain untouched as the kernel evolves. This is just FYI. Sure, but what else am I supposed to do to send UDP packets? The usual user APIs like bind() or sendto() are not available in the kernel. B) Use the source, Luke. The 'xnu' project contains the code that both implements and uses these calls, and you should be able to make use of it to get the information you need by reading code. I tried, but it's going to take a long time to figure out just how I have to write 5 lines of code to send my tiny packet. Source code is not a replacement for a man page, otherwise cars came with a screwdriver instead of a manual. In particular, check the "aurp" code in the "bsd/netat" directory. This code sets up a UDP tunnel between the local system and a remote system to transmit AppleTalk packets; it should have a lot in common with your efforts. I "greped" over the xnu source for sosend() and SOCK_DGRAM, and I think I found the aurp piece. I am slowly figuring out what the arguments of the sosend() might be, but I couldn't figure out how to create and use a struct mbuf. C) As a guide to the code, you should consider looking at Wright/Stevens, "TCP/IP Illustrated, V.2", Addison-Wesley, 1995. I'll try and check a library. From: Wally Crooze <wallycrooze@pobox.com> The interface is found in xnu/bsd/sys/socketvar.h. To create a socket you call socreate. sosend is used to send both UDP and TCP packets. This is determined by arguments passed to socreate. I got that far too, but my packets are being rejected. My calls so far are: error = socreate (AF_INET, &sock, SOCK_DGRAM, IPPROTO_UDP); ... error = sosend (sock, (struct sockaddr*) &sockaddr, &uio, NULL, NULL, 0); But it always returns 61 (connection refused?). This is some source code that was originally for TCP packets and it works fine for TCP, but I wasn't able to turn it into working code for UCP. MacOSX uses the FreeBSD implementation of socket calls and is documented in "The Design and Implementation of the 4.4BSD Operating System" published by Addison Wesley. Am I the only one who think it's strange that proper documentation for the innerts of a free operating system that has been distributed for years over the internet is only available in books but not online or in man pages? Stefan _______________________________________________ darwin-kernel mailing list | darwin-kernel@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-kernel Do not post admin requests to the list. They will be ignored.
participants (1)
-
Stefan Werner