• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting UDP sockets to work
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting UDP sockets to work


  • Subject: Re: Getting UDP sockets to work
  • From: Liwei <email@hidden>
  • Date: Mon, 11 Aug 2008 19:51:40 +0000

Ah... byte order problems!

But somehow adding htons to the number made the app crash on my side,
and I'm very certain I'm on Intel.

> Date: Mon, 11 Aug 2008 11:37:45 +0100
> From: Quinn <email@hidden>
> Subject: Re: Getting UDP sockets to work
> To: email@hidden
> Message-ID: <p06240828c4c5c5129c65@[10.0.40.15]>
> Content-Type: text/plain; charset="us-ascii" ; format="flowed"
>
> At 1:19 +0800 10/8/08, Liwei wrote:
>>So am I right to say that CFSocket is just a thin wrapper around the
>>native BSD sockets such that I can use run loops?
>
> That's absolutely correct.  The primary goal of CFSocket is to
> provide a way to integrate sockets in a runloop.  Doing this without
> CFSocket is a total pain.
>
>>Can someone explain to me what is wrong?
>
> If you're running this on Intel then the one thing that's definitely wrong is:
>
> At 1:19 +0800 10/8/08, Liwei wrote:
>>       struct sockaddr_in sin_struct = {0, AF_INET, 5555, 0};
>
> You need a "htons" around the 5555, just like you would if you used
> the BSD sockets API.
>
> With that fix in place I ran your program and it worked AFAICT.
>
> S+E
> --
> Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
>
>
> ------------------------------
>
> _______________________________________________
> Macnetworkprog mailing list
> email@hidden
> http://lists.apple.com/mailman/listinfo/macnetworkprog
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Getting UDP sockets to work
      • From: Jaime Magiera <email@hidden>
  • Prev by Date: Re: Getting UDP sockets to work
  • Next by Date: Re: Getting UDP sockets to work
  • Previous by thread: Re: Getting UDP sockets to work
  • Next by thread: Re: Getting UDP sockets to work
  • Index(es):
    • Date
    • Thread