Socket Communication in iPhone
<p>I have many images in iPhone. I have to send this images to server using a socket communication. what all we need to do to send the images to server through socket.</p>

<p>If i use this code i can send string. what all should i change in the code so that i can send image through socket. I am new to network programming so some please help me to find a solution</p>

<p>CFWriteStreamRef writeStream = NULL;</p>

<p>CFStringRef host = CFSTR("192.168.1.211");
UInt32 port = 8001;</p>

<p>CFStreamCreatePairWithSocketToHost(kCFAllocatorDef ault, host, port, NULL, &amp;writeStream);</p>

<p>CFWriteStreamSetProperty(writeStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue);</p>

<p>if(!CFWriteStreamOpen(writeStream)) {
NSLog(@"Error Opening Socket");
}
else{
UInt8 buf[] = "Hi !!!";</p>

<p>int bytesWritten = CFWriteStreamWrite(writeStream, buf, strlen((char*)buf));
NSLog(@"Written: %d", bytesWritten);</p>

<p>if (bytesWritten &lt; 0) {
CFStreamError error = CFWriteStreamGetError(writeStream);</p>

<p>}</p>

<p>}</p>

<p>Thanks, </p>
