Socket programming in iphone - iphone

I want to send/receice some data to remote machine within network.
I have referred chatty application but it is broadcasting the service but i need to establish one is to one connection.
how can i set sockets for sending and receiving data in iphone?
does any one have any idea? i am new to network programming please help me about this.
Regards,
Sanket

If you want to learn about CFNetwork, then I recommend: Zdziarski's iPhone SDK Application Development - Chapter 7
There are complete explanation of sockets ;)

Related

Socket Connection on iPhone

I want to establish socket connection between iphone and a web service that has its own IP address, service name (e.g "_abc._tcp"), and it also contains information about files stored. How can I do this? Can you please help with some sample code or links.
My goal is to develop an application that will get a video file from that server to my iphone and play it.
At first I try to get information of the files but I don't know how to connect to that server and make the video played on my iPhone.
Many thanks in advance
There is a great library for socket programming in objc here CocoaAsyncSocket
Which will help you out a lot. The examples also show how to use NSNetServices to broadcast a Bonjour service.

Communication between two iOS devices

I am looking for a way to have one iPhone app send a message to another app on a different phone (sort of like a Sender-Receiver set up). I am looking for the best possible way to do this. Does anyone have any ideas and/or tutorials?
Thanks for the help.
You should use GameKit. It is super easy to send messages between two iOS devices using it. Here's a great tutorial: Game Kit. You can also get more information about it here from the docs: About Game Kit.
You communicate by creating an ad-hoc bluetooth or local wireless network.
lmirak provided insightful info about device communication(especially about GameKit). I would like to add one more solution. You can use WiFi network to do your device communication.
See the link or download the sample application from developer.apple
The sample application named as WiTap. It demonstrates how to achieve network communication between applications. Using Bonjour, the application both advertises itself on the local network and displays a list of other instances of this application on the network.
If your app is only going to run on iOS, then you should use the fantastic MultipeerConnectivity library. https://developer.apple.com/documentation/multipeerconnectivity
If you need a solution that will work cross-platform, then one way to accomplish this is using sockets and connecting over a local network. On iOS you can use CocoaAsyncPods for sockets and NetService for discovery.
Here is a basic example app that does this: https://github.com/brendaninnis/LocalNetworkingApp
, which I explain in great detail here: http://brendaninnis.ca/connect-nearby-devices-part-1.html

How to create a Mac/PC server app that interacts with iPhone/iPad App?

Can someone please point me in the right direction to create a Mac/PC server app that runs in the background and connects to an iPad app over the local WiFi network?
No matter how I phrase a search on Google it just brings up various apps like Remote Mouse and whatnot and no tutorials or even a hint of where to start.
I just need to send simple commands from iPad to computer over local wifi. A point in the right direction and I can likely fill in the blanks.
Thank you.
Thomas
EDIT: I am using web languages for the iPad version that I will build as a native app using open source tools.
OK, then. It actually depends on what you really need. I made the assumption you need real-time and perhaps binary data transfer.
Your best bet is to write your server application using standard C or C++ so it compiles on both as simply as possible.
If you want to avoid all the burden of writing a protocol for service discovery or asking users to enter the ip address of your server you will use a mDNS implementation for your server and your iPhone app.
If I were you I would try bonjour: http://www.apple.com/support/bonjour/
on iPhone You could start here: http://developer.apple.com/library/mac/#documentation/Networking/Conceptual/NSNetServiceProgGuide/Articles/PublishingServices.html
Once you have your sockets you will have to implement a networking protocol between your server application and your iPhone app.
You will have to be careful about byte ordering and little subtle problems with latency, disconnections and other problems inherent to networking and WiFi.
In windows you will want to register your application as a service and in Mac OS X/UNIX you'll probably want to deamonize it.
Good luck!

Iphone send data over a local network between two iphones

i'm developing an app to exchange data between two iphone's connected to the same local network but i don't know where to start.
Anyone can show me and example in order to achieve this?
Thanks!
Take a look at peer to peer connectivity in Game Kit and decide whether this is what you need.
Alternatively, Bonjour API and standard network programming is available.

iphone PC TCP/IP connection

I'm looking for the faster and easy way to connect the iphone to the PC with IP/Port connection.
Anyone has a good idea?
thanks in advance
Gilad
Not sure if this is what you are looking for, but this Mobile Development Wiki provides some information on how to communicate using low level sockets on the iPhone.