• 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: Using CFSocket to connect
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using CFSocket to connect


  • Subject: Re: Using CFSocket to connect
  • From: Douglas Davidson <email@hidden>
  • Date: Wed, 3 Jul 2002 15:49:51 -0700

On Tuesday, July 2, 2002, at 09:46 PM, Mike Laster wrote:

I'm making progress. I can accept connections, and successfully read data
on those connections. Now I'm getting around to implementing connect and am
running into problems.

I successfully create a socket with CFSocketCreateWithSocketSignature, but
When I call:

CFSocketConnectToAddress(socketRef,socketSignature.address, 60);

I get a -1 error code. I'm not sure why it's failing.

CFSocketCreateWithSocketSignature creates a socket of the requested type and binds its address (using CFSocketSetAddress) to the requested address. If this fails, it returns NULL. CFSocketCreateConnectedToSocketSignature creates a socket suitable for connecting to the requested type and address, and connects it (using CFSocketConnectToAddress). If this fails, it returns NULL.

What you want is CFSocketCreateConnectedToSocketSignature(). This will do the CFSocketConnectToAddress() for you. Alternatively, you can create the socket with CFSocketCreate() and make a separate call to CFSocketConnectToAddress().

Douglas Davidson
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Using CFSocket to connect
      • From: Mike Laster <email@hidden>
References: 
 >Re: Using CFSocket to connect (From: Mike Laster <email@hidden>)

  • Prev by Date: Run loops
  • Next by Date: CFSocketRegisterSocketSignature question
  • Previous by thread: Re: Using CFSocket to connect
  • Next by thread: Re: Using CFSocket to connect
  • Index(es):
    • Date
    • Thread