[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 11:27:14 +0100 |
User-agent: |
Thunderbird 2.0.0.23 (X11/20090817) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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).
- --
Saso
Andreas Höschler wrote:
> Dear Saso,
>
>> Modified code snipped below:
>
> Thanks a lot for the modified code snippets. I have incorporated your
> code into my UDPSender project (attached). When I run that I get
>
> bash-2.05a$ /Build/UDPSender/obj/UDPSender
> Sending packet 0
> sendto() failed: Socket is already connected
> Sending packet 1
> sendto() failed: Socket is already connected
> Sending packet 2
> sendto() failed: Socket is already connected
> Sending packet 3
> sendto() failed: Socket is already connected
> Sending packet 4
> sendto() failed: Socket is already connected
> Sending packet 5
> sendto() failed: Socket is already connected
> Sending packet 6
> sendto() failed: Socket is already connected
> Sending packet 7
> sendto() failed: Socket is already connected
> Sending packet 8
> sendto() failed: Socket is already connected
> Sending packet 9
> sendto() failed: Socket is already connected
> bash-2.05a$
>
> on the Mac and
>
> -bash-3.00$ /Build/UDPSender/obj/UDPSender
> Sending packet 0
> sendto() failed: Transport endpoint is already connected
> Sending packet 1
> sendto() failed: Transport endpoint is already connected
> Sending packet 2
> sendto() failed: Transport endpoint is already connected
> Sending packet 3
> sendto() failed: Transport endpoint is already connected
> Sending packet 4
> sendto() failed: Transport endpoint is already connected
> Sending packet 5
> sendto() failed: Transport endpoint is already connected
> Sending packet 6
> sendto() failed: Transport endpoint is already connected
> Sending packet 7
> sendto() failed: Transport endpoint is already connected
> Sending packet 8
> sendto() failed: Transport endpoint is already connected
> Sending packet 9
> sendto() failed: Transport endpoint is already connected
> -bash-3.00$
>
> on Solaris!?
>
> Any ideas?
>
> Regards,
>
> Andreas
>
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAksOWAIACgkQRO8UcfzpOHCECgCdGOwEXXIFZJL9TgJw035woCbS
U4gAoKIgY2aNtBOmF7n/FW8nklmBJeLH
=5tmi
-----END PGP SIGNATURE-----
Re: Sending UDP packets, Andreas Höschler, 2009/11/26
Re: Sending UDP packets, Derek Fawcus, 2009/11/26