Looks like to be a bug in CFSocketRef
Looks like to be a bug in CFSocketRef
- Subject: Looks like to be a bug in CFSocketRef
- From: Stephane Sudre <email@hidden>
- Date: Tue, 16 Aug 2005 19:06:31 +0200
I'm trying to communicate with a kernel extension using the kern
control APIs (Mac OS X 10.4.x).
Results:
--------
o When I build my project on a 10.1 machine, this is working fine.
o When I build it on 10.2 or later, it does not work.
What I mean by "it does not work":
----------------------------------
The user land socket is connected successfully AFAIK but the
readCallBack is never "called back".
This is the code I'm using:
---------------------------
CFDataRef tDataRef;
CFSocketSignature tSocketSignature;
PseudoKernControlStruct tStructure; // PseudoKernControlStruct is a
copy of the Kern control struct to be able to compile on pre 10.3
system
bzero(&tStructure, sizeof(tStructure));
tStructure.sc_len = sizeof(tStructure);
tStructure.sc_family = AF_SYSTEM;
tStructure.ss_sysaddr = AF_SYS_CONTROL;
tStructure.sc_id = 'IDID';
tStructure.sc_unit=1;
tDataRef=CFDataCreate(kCFAllocatorDefault,(unsigned char *)
&tStructure,sizeof(tStructure));
tSocketSignature.protocolFamily=PF_SYSTEM;
tSocketSignature.socketType=SOCK_DGRAM;
tSocketSignature.protocol=SYSPROTO_CONTROL;
tSocketSignature.address=tDataRef;
mySocketRef_ =
CFSocketCreateConnectedToSocketSignature(kCFAllocatorDefault,&tSocketSig
nature,kCFSocketReadCallBack,MySocketCallBack,&_socketContext,NKE_CONNEC
TION_TIME_OUT);
if (mySocketRef_!=NULL)
{
mySocketSource_ = CFSocketCreateRunLoopSource(kCFAllocatorDefault,
mySocketRef_, 0);
CFRunLoopAddSource(CFRunLoopGetCurrent(), mySocketSource_,
kCFRunLoopDefaultMode);
}
if (tDataRef!=NULL)
{
// Release Memory
CFRelease(tDataRef);
}
Notes:
------
When compiled on 10.1 and run on 10.4: it works. MySocketCallBack is
called back.
When compiled on 10.4 and run on 10.4: it does not work.
MySocketCallBack is not called back.
When compiled on 10.3.9 with the 10.2.8 SDK, it does not work.
MySocketCallBack is not called back.
IIRC, I had seen this problem in the past with NKEMgr socket too.
_______________________________________________
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