Ad Hoc Wifi Connection Between iPhone & Mac - Possible? - iphone

I was just wondering if it is possible to set up a data transfer tunnel between an iPhone and a Mac using the Wifi hardware present on both devices? My main objective is to transfer data from my iPhone to my Mac through an app along an ad hoc wifi connection. If there are any other methods you would like to suggest, then please do.
Looking forward to your replies.
Thanks!
A.K.

You can make use of Bonjour, via NSNetServices and CFNetServices APIs.
Basically:
Create a server on the Mac
Announce the server via Bonjour
Browse Bonjour on the phone and resolve the bonjour service.
Establish connection
Exchange data via socket streams

You cannot automagically do this, yet. That is, you must manually create the ad hoc wireless network (a "computer-to-computer network" in Apple parlance) first on the Mac, then join the iPhone to it just like any other WiFi network. After this, the methods suggested above will work just fine.
What I think you are suggesting, also known as WiFi Direct, is a very new specification that is not yet supported by the iPhone or OS X (as of this writing).

You'd probably want to look at NSNetServices/CFNetServices (Bonjour) for a common API to accomplish that sort of connection.

Related

Create an iPad app that can send/receive data via the USB cable?

I want to create an iPad app that connects to another machine, laptop or otherwise, via USB and communicates to some other application I develop running there.
I know that this is easy to achieve via Bluetooth or WiFi but this particular set of solutions must be done via a USB cable.
Is it possible to do so without access to the Apple MFi program? (I am about 5 weeks in and the response is not looking good).
iOS App --> USB Cable --> Mac OSX --> Desktop App (without MFi access)
Thanks
To use USB communication Apple does not provide any API within IOS SDK. The only option right now is MFI. I don't think Apple will allow this in near future.
To use serial communication, you need MFI as you may have discovered. However, there is a poor man's way of achieving this. I have done so during development.
Enable "Internet sharing" on your device and connect to it. Use "ifconfig" on your Mac to find out the interface to use. You do not need to use this as the default connection, but it needs to be active. If I remember correctly, only one end can initiate connections (it was a while so I am sorry that I don't remember the details).
EDIT: I would also like to point out that I did this on an iPhone, not an iPad.
Not over USB but over RS232 (serial port)
Look here: http://www.redpark.com/c2db9.html
But:
The cable uses the old 30 pin connector, but according to them it's compatible with the Lightning adapter
The application won't be accepted on the AppStore, it's for internal use only.
There is a (small) book that explains how to use this cable to connect an iPhone directly to an Arduino, it's been published in late 2011. "iOS Sensor Apps with Arduino Wiring the iPhone and iPad into the Internet of Things" http://shop.oreilly.com/product/0636920021179.do

iOS Bluetooth printer?

Does anybody suggest a mobile printer able to print receipt with a good SDK to interface wireless an iOS application adhoc developed ? The printer should be small and should use rechargeable batteries for field use.
I cannot use wifi because not always a trusted access point (customer premises) is available, so I think to use Bluetooth, but of course any suggestion is welcome !
FYI I already checked Zebra printers SDK for iOS but it seems able to print only using a TCP/IP address, it means (for as I know) I should use wifi. In my case the application should be used in the field from an iPad connected with cellular network. In iPad there is no hot-spot and not always there is an available wifi access point tho connect the iPad and the printer the the same network to use TCP/IP addresses. That is the reason I'm guessing the last chance should be bluetooth.
Unfortunately iOS5 does not support Bluetooth printing.
http://support.apple.com/kb/ht3647
Have you considered VPN via WEP to a network printer?
Alternatively some printers can be set up with their own email address. PDF attachments can be sent via this address to be printed. These emails can be sent encrypted.
I know that this isn't the IDEAL answer, but it is likely to work for the time being until iOS is properly updated.
Yes, I have Bluetooth printer for IOS device, it is Apple MFI approved
see details from this URL http://www.bluebamboo.com/other_file/P25i%20Datasheet%20%28EN%29%20v1.0%2009-Oct-2011.pdf
I know you already accepted an answer, but here's another one: have the technician bring their own wireless base station (AirPort Express perhaps) and create his own wireless network (that won't have internet access, but that's not needed) with appropriate security. Then you can use any HP wireless capable printer and have the iOS device and the printer connect to the wifi network created by the wireless access point (which should be set with DHCP to vend IP addresses in a non-routable range like 192.168.x.x, obviously).
We also have a Bluetooth printer that is MFI certified along with an easy to understand iOS SDK. Please take a look at the EZPay App on the Appstore. The app's currently in Japanese (fir one of our clients) but the description explain a little about the printer. I'm currently traveling at the moment, but if you shoot me an email from the contact info on the App Store. I can get a few other things out to you. Cheers... B
No need to develop a full blown SDK, check out Mobi Print. it has the Zebra sdk already implemented and connects to any webservice or ODBC database. It also has stored label/receipt formats in there app so just upload your format and should be good to go.
here is link for Mobi Print

Communication between iOS app in one Wi-Fi network w/o server

I need to communicate my app with 2 devices. A restriction is that I can't use a server but all iOS devices will be in one Wi-Fi network. What options do I have? How I can send a message to another copy of my app running on another device?
I dont know whether its a correct approach or not but as you cannot use server,so the approach i can think of is we can create a socket connection using TCP/IP or UDP(based on reliability) for data exchange.
I dont think you can communicate between 2 devices running the same application without having some kind of server application in-between.
Even if you could find the other device over the WIFI I dont think you can tell if the other device is running the app or not.
I think you may be referring to MultipeerConnectivity
The Multipeer Connectivity framework provides support for discovering
services provided by nearby iOS devices using infrastructure Wi-Fi
networks, peer-to-peer Wi-Fi, and Bluetooth personal area networks and
subsequently communicating with those services by sending
message-based data, streaming data, and resources (such as files).
Source: https://developer.apple.com/library/ios/documentation/MultipeerConnectivity/Reference/MultipeerConnectivityFramework/
Apple Sample:
https://developer.apple.com/library/ios/samplecode/MultipeerGroupChat/Introduction/Intro.html

iPhone interaction between PC app and iPhone app using USB

I know since the 3.0 SDK we can use accessories, so my question is simple, what is the process to make an iPhone app and PC (or Mac) app interact, using the USB ?
I don't ask you any code, but just the paths and the keys for making that work.
Have I to access the iPhone disk through SSH and work with files ?
Or can I send data from the iPhone app and intercept (get) it on the PC app (and send data from PC to iPhone) ?
Thanks, and if this question is stupid, just tell me, I didn't find on Dev Center (I don't really know what I have to looking for...) !
Edit : I read some news from Microids, they will synchronize PC and iPhone games (i.g here), and somewhere (I can't find it again) they say connecting the iPhone on the USB, so I think this is possible
USB access on the phone is only supported via the External Accessory Framework. You cannot hook the iPhone up to arbitrary USB devices, the devices actually have to support the EA protocol. You can get more details about it via the Made for iPhone program.
Other than that there is no USB access available on to applications.
You want the External Accessory Framework. Having said that, I'm not sure that Apple's intention was for you to communicate with an application on a PC/Mac. It's really for talking to accessories such as iPod docks, remote controls, etc. Apple may not allow an application that talks to a PC in this manner in the App Store.
You might be interested in ssh_relay (earlier called iphone_tunnel).
There is a /System/Library/Lockdown/Services.plist on your iPhone and you can start any such services via AMDeviceStartService and then communicate with it.
The ssh_relay demonstrates how to do that by having a simple port forwarder as a service on the iPhone site and the client application on your PC, so you can forward any local iPhone port to your PC. This is not exactly what you wants here (it is handy in the case you have already another service running on the iPhone which communicates via simple TCP and you want to access that; for example SSH) but based on this example, it should be straight-forward to have any communication between the service (in Services.plist) and your PC.

Is it possible to do streaming WiFi Communications on the iPhone?

I am looking to develop an iPhone application that will require point-to-point WiFi communications on an iPhone. I would like to use the WiFi interface and have the application stream between the phone and a WiFi device. Does anyone have some experience with this? Is it even possible? I know there is a discovery application but I am looking for something a little more robust.
As far as I know (as the SDK stands now), the only thing available is communication over the existing network connection. The SDK doesn't allow for setting up wireless network connections, or creating ad-hoc networks. I believe the only way to join or create wifi networks is through the settings app.