Re: Using CFSocket to connect
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.