views:

37

answers:

1

Hi,

I have an application that was written in Java and runs on the users machine. I now want to build an application on the iPhone which will communicate with my java app.

Can somebody point me in the right direction on how I can send and receive TCP packets with the iPhone, I want to of course be able to do that using wifi and 3G.

Thanks,

A: 

You use the NSStream classes. I've found it pretty easy to use.

See the SimpleNetworkStreams for an example.

One problem I found is that the iphone sdk does not include the NSStream method getStreamsToHost:port:inputStream:outputStream: which is what Mac OS examples use to open a NStream connection but there are lots of places that show you how to create your own like here.

Shane Powell