discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sending UDP packets


From: Saso Kiselkov
Subject: Re: Sending UDP packets
Date: Thu, 26 Nov 2009 13:00:13 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Year, right, I forgot about the imr_multiaddr type - I copied it off of
my code which already passes an in_addr structure in the assignment.

I work quite a lot in the multicast/streaming/IPTV area (and write a lot
of ObjC/GNUstep code for that purpose), so I'm glad to be of help.

- --
Saso

Andreas Höschler wrote:
> 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
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAksObc0ACgkQRO8UcfzpOHDEwwCfY8N0QKy3lCN2Qf7rYIQXkvNs
wwkAn0v54HNjobqvyJcv4Mrg7oUWTOWY
=Wrem
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]