Kapil Choubisa
Kapil Choubisa

Reputation: 5232

Transfer file from one ios device to another using wifi and 3G network?

I am just curious to learn if I can send file from one ios device to another using wifi or 3G network. I am not sure this is possible or not.

I gone through apple's documentation of CFNetwork reference and I found cfftp reference. I am not able to understand it clearly as it is saying that we can implement read stream from remote server.

I want to read file from one device to another device and write the same using wifi of both devices same as the way we can do using Bluetooth.

  1. Is it possible to send file using wifi and 3G network by connection only 2 devices? (No mediator)
  2. Am I looking for right direction?
  3. If no please guide me to right direction.
  4. Is there any class for wifi and 3G file transfer in ios?

thanks in advance.

Upvotes: 1

Views: 4026

Answers (2)

闪电狮
闪电狮

Reputation: 556

The library GCDWebServer was awesome !

It creates a server on your device and provides a web panel to access the server on another device.

Here is the Swift version:

import GCDWebServer
var webUploader = GCDWebUploader()

    func start() {
        let documentsPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).map(\.path).first
        
        webUploader = GCDWebUploader(uploadDirectory: documentsPath!)
        webUploader.start()
        if let serverURL = webUploader.serverURL {
            print("Visit \(serverURL) in your web browser")
        }
    }

enter image description here

Upvotes: 0

Rodja
Rodja

Reputation: 8081

To do transfers between two devices without a mediator, at least one device must run some kind of a server (like http://code.google.com/p/ios-ftp-server/, for the client see SimpleFTPSample). But then you also need to discover ip addresses (maybe with ZeroConf). A lot of hassel, if possible at all; both clients must be in the same network and therefor won't work on 3G.

If you are ok with a mediator, things get much simpler. I have created an Open Souce App called cross copy which uses http REST commands to transfer files between devices (and hence also provides a web app for the desktop). Obviously there are other nice mediator-based solutions: DropBox, Bump, Hoccer, etc

Upvotes: 1

Related Questions