My situation is explained in the code below. I need to send via a socket NSString drawn from a TextBox
Thank you very much
NSString *string = fieldTesto.txt;
// I Find an istruction for insert s string in to the CFSocketSend
UInt8 message[] = "Hello world";
CFDataRef data =
CFDataCreate(NULL, message, sizeof(message));
CFSocketSendData(s, NULL, data, 0);
CFRelease(data);
You can convert your string to NSData
and then use the toll-free bridging to CFData
.
NSData *data = [string dataUsingEncoding: NSASCIIStringEncoding];
...
CFSocketSendData(s, NULL, (CFDataRef)data, 0);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.