I am able to connect to the PC server from the Mac using BSD socket functions. I am using CFSocketCreateWithNative() to get CFSocket from the BSD socket, and install a network event callback function. In that function, I have the following code:
case kCFSocketDataCallBack:
event = FD_READ;
CFDataGetBytes( address, CFRangeMake(0,CFDataGetLength( address )), sockdata->m_ReceivedData );
sockdata->m_AmountBuffered = CFDataGetLength( address );
break;
The pointer sockdata->m_ReceivedData is allocated with the size 64 * 1024.
The problem is that the data I am getting sent back is nothing like what the server is sending. Here's what's happening.
The server is sending a stream of 27 bytes:
17 00 00 00 92 c1 77 41 fd 27 f0 84 3c 64 b4 7f 2b 23 28 a4 8f 69 f8 25 7e bc 1f
What I get in my buffer after the CFDataGetBytes() is 16 bytes:
10 02 03 85 c0 a8 01 7f 00 00 00 00 00 00 00 00