• 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: Socket communications
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Socket communications


  • Subject: Re: Socket communications
  • From: Andrew Farmer <email@hidden>
  • Date: Wed, 8 Aug 2007 17:12:02 -0700

On 08 Aug 07, at 16:41, Maryanna Rogers wrote:
I've got two simple applications that I'm trying to get to talk over a
socket. After much digging, it appears relatively straightforward.
Sadly, I can't get the client to connect. ("a.b.c.d" is the ip of the
server).

The server does this:

<...>
addr.sin_port = 3421;
<...>

First of all, you need to apply htons() to sin_port, or it'll end up using port 23821 on Intel machines. (3421 = 0x0d5d, 0x5d0d = 23821. Byte ordering strikes again!)

Also, you may have an easier time working with NSStream/CFStream. See this forum thread for a brief overview:

http://www.mackb.com/Uwe/Forum.aspx/programming/2158/Sockets-in-Cocoa
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Socket communications (From: "Maryanna Rogers" <email@hidden>)

  • Prev by Date: Re: Loading data in a background thread and displaying it with Bindings
  • Next by Date: Re: Integrating Unix scripting in Cocoa app
  • Previous by thread: Socket communications
  • Next by thread: NSString drawInRect - Vertically Align
  • Index(es):
    • Date
    • Thread