w00
w00

Reputation: 26772

iphone connect to server

I want my iphone to connect to a C# based server. Nothing special really, but i've read that programming sockets isn't as straightforward as it is in C# or Java?

What i eventually need to do is send an image (in bytes) to the server using some async socket connection (TCP).

I've read some topics from others in which they got pointed to the AsyncSocket project: http://code.google.com/p/cocoaasyncsocket/

But it looks like this project isn't supported anymore? (Couldn't find a download link, just deprecated examples...)

Are there any other recommendations which i can use for my iphone app?

Upvotes: 0

Views: 1007

Answers (1)

sergio
sergio

Reputation: 69027

Have a look at this tutorial: How To Create A Socket Based iPhone App and Server

The client part will guide you through the correct use of NSStreams for handling your socket based communication. You can skip the Python server part.

EDIT: how do you send the image?

roughly, it could go like this:

NSData* data = UIImagePNGRepresentation(image);
[outputStream write:[data bytes] maxLength:[data length]];

like this, your image bytes would be sent to the server; the server should then store them to disk or whatever sensible for your app.

Upvotes: 2

Related Questions