|
From: | Andreas Höschler |
Subject: | Re: Sending UDP packets |
Date: | Thu, 26 Nov 2009 12:18:19 +0100 |
Dear Saso,
Simple: you didn't replace sendto() with a call to write() - Linux accepts this (it simply regards connect() as a 'default' send address, and allows you to override it on a per-packet basis using sendto()),whereas Solaris and OSX will complain that it is invalid to use sendto()on a socket with a destination address already set using connect(). I don't have OSX to test exactly, but my Solaris 10 machine stopped complaining after I replaced sendto() with write() and I think OSX will shut up as well (seems to be the same error).
Yeapp! That was it! I still had to fix a small bug in the receiver code to get it compiled: ... // join the multicast group using IGMP struct ip_mreq req; if (inet_aton(GROUP_IP, &req.imr_multiaddr.s_addr) == 0) { fprintf(stderr, "inet_aton() failed\n"); exit(1); }// req.imr_multiaddr = GROUP_IP; // imr_multiaddris of type in_addr
req.imr_interface.s_addr = INADDR_ANY; ...But this seems to work now. I run the receiver on Solaris and the sender on MacOSX and it worked!! I will now put all this in an Objective-C wrapper to make it ready for productive use! :-)
Thanks a lot for your help Saso!!! Best wishes, Andreas
[Prev in Thread] | Current Thread | [Next in Thread] |