Re: CFSocketConnectToAddress
Re: CFSocketConnectToAddress
- Subject: Re: CFSocketConnectToAddress
- From: Robert Kuilman <email@hidden>
- Date: Wed, 13 Aug 2003 13:15:03 +0200
Hey there!
i use this code for setting these values in the CFDataRef:
struct sockaddr_in theName;
struct hostent *hp;
CFDataRef addressData;
theName.sin_port = htons(my_port_number_argument);
theName.sin_family = AF_INET;
hp = gethostbyname( my_host_address_argument );
if( hp == NULL ) {
return FALSE;
}
memcpy( &theName.sin_addr.s_addr, hp->h_addr_list[0], hp->h_length
);
addressData = CFDataCreate( NULL, &theName, sizeof( struct
sockaddr_in ) );
well, this works for me, so i guess it should work for you too!
note: one should be including the following headers:
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
Hope That Helps!
Robert K.
-----------------------------{ Official Cocoa Newbie!
}-----------------------------
web:
http://halfduplex.net/
email: email@hidden
On Wednesday, August 13, 2003, at 11:58 PM, Igor Garnov wrote:
When I call "CFSocketConnectToAddress" function, the second parameter
is an address of a remote host to which I am connecting.
This parameter is of type CFDataRef.
How can I set this parameter up having the remote host's IP and port?
Is there a function that takes these as parameters and returns
CFDataRef?
Unfortunately, I could not find any sample code that uses CFSocket
calls. Is there any?
A tiny code snippet would be nice.
With the best regards,
Igor Garnov
_______________________________________________
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.
_______________________________________________
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.