Hey all,
Another (sort of) networking question for you:
I ditched SmallSockets and starting using AsyncSocket, as it's small (very) and supports delegation (which I wanted very badly) via CFSocket and related classes...
Here's my problem...
The protocol I'm using (not mine, so don't mock, I know it sucks hard) sends EVERYTHING directly to/from the (raw) socket with no encoding as in:
send(socketfd, &charbuf, length, 0);
recv(socketfd, &incharbuf, length, 0);
My question is this... if I'm using AsyncSocket (which encapsulates all data send/recieved inside an NSData object) how can I access this data properly (as text)?
I've tried using NSString's initWithData:encoding: method to access the data in a more readable sense... I've also tried using NSData's getBytes method to dump it directly into an unsigned character array... both of these approaches produce garbage.
So... how can I (properly) dump an NSString as plain (unencoded) text into an NSData object, and conversely how can I convert said NSData object back to it's string representation?
Thanks for any help!