iphone - USB communication between iPad and Mac or PC -
I would like to write an iPhone / iPad app that can communicate with a Mac or PC program through a USB connection ( Which I also have to write). Does anyone know how I can go about doing this? (I know that I may need to jailback my iPad)
Socket communication via USB (USBMX) can get your needs. When an iPad or iPhone plugs into the Mac, a device description will be / var / run / usbmuxd. You can create a socket and connect it to / var / run / usbmuxd and / or send / packaged data from an iOS device. The data should be wrapped.
This is a brief reference from Fahonwikis, which I can provide is sample code to connect to USBMDD.
struct sockaddr_un endpoint; Size_t size; _usbMuxSocket = Socket (PF_LOCAL, SOCK_STREAM, 0); Endpoint.sun_family = AF_LOCAL; Strncpy (endpoint.sun_path, "/ var / run / usbmuxd", 17); Size = (offset (straight sockaddr_un, sun_path) + strlen (endpoint.sun_path) + 1); Connect (_usbMuxSocket, (struct sockaddr *) and endpoint, size); After this you have to "connect" on your app listening port on the iPad. After the work of preparing the "connect" process discussed in the wiki page list above in the section section, you can use the socket to send and read data.
Comments
Post a Comment