Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

Graves Robber
($1.99)

African Adventure
($0.99)

iTazer
($0.99)

ArtStudio
($3.99)

Pigs Vs Wolves
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 06-30-2009, 05:45 AM   #1 (permalink)
ccp
New Member
 
Join Date: Jun 2009
Posts: 5
Default CFSocket Error: Operation not permitted

Hi.

I wanted to send a photo to a server on my laptop via socket. I created an instance of CFSocket, and configured everything. Now, client(my iphone) and server(my laptop) are connected.

But when i send the photo data, it keeps saying that "Operation not permitted". I know it's not allowed to write files outside of Application Home folder. But is socket now allowed in iPhone? I don't think so, as a lot of apps are using it. Does anyone know how to deal with this?

Here I show you a part of my code:
Code:
- (void)sendPhoto:(CGImageRef)image
{

    //Get JPEG data
    NSData *data = UIImageJPEGRepresentation((UIImage*)image, 1.0);

    //Get file descripter
    CFSocketNativeHandle fd = CFSocketGetNative(tcpClient);

    //Check if it's valid
    if (fd < 0) 
        return;

    //Get size
    size_t size = [data length];

    //Send data
    int bytesSent = send(fd,[data bytes],size,MSG_EOR);

    //I should check if bytesSent is -1,
    //but i'm getting this error every time.
    NSLog(@"%s",strerror(errno)); //"Operation not permitted"
}
Thanks.
ccp is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 23,591
Threads: 38,348
Posts: 168,506
Top Poster: smasher (2,539)
Welcome to our newest member, gotaway
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:35 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0