Question

I have been trying to figuring out if it is possible to send files between a wp8 device and a windows rt (Surface). Some people seem to write that this is possible but they never write how to do this.

So what I want to do is 1. record a video with my app on the wp8 device and save it to the isolated storage (this is where Im at, at the moment) 2. Send the video (approx 20min recording time) to my windows rt device 3. Play the video on the rt device. Step 1 & 3 are simple but step 2 is driving me crazy. I have been thinking about using Bluetooth but as the speed is just around 700kbit/s it will take forever to transfer it. Usb is a no go as it is in the isolated storage. Skydrive needs 3g. So what I am thinking is to start internet sharing on my wp8 device and then connect my windows rt device to it and when its done use wifi to send the video from wp8 to win rt.

Is there any way this could work or is this impossible?

Was it helpful?

Solution

If your devices are in the same Wi-Fi network, you can use it to send files. Glossing over the details, this could be achieved in two steps:

  1. Make devices discover each other in the network (they should know each other's ip addresses).
  2. Implement file sending over a tcp socket. The simplest approach is to split the file into chunks of some arbitrary, but small size, and send those chunks one after another.

Of course, it's a high-level description, so if you need some further help in topics mentioned above, feel free to ask.

EDIT: This url says that there's a possibility to listen to incoming network connections, because related class is available for Windows Store apps and for Windows Phone 8. You can use it as a starting point.

EDIT 1: I've quickly put up an example for you, to prove it works. Just tested it on my Lumia 920.

Windows.Networking.Sockets.StreamSocketListener listener = new Windows.Networking.Sockets.StreamSocketListener();                    
listener.ConnectionReceived += async (_, args) =>
{
    var w = new Windows.Storage.Streams.DataWriter(args.Socket.OutputStream);
    w.WriteInt32(42);
    await w.StoreAsync();
};
await listener.BindEndpointAsync(new Windows.Networking.HostName("127.0.0.1"), "55555");
var clientSocket = new Windows.Networking.Sockets.StreamSocket();
await clientSocket.ConnectAsync(new Windows.Networking.HostName("127.0.0.1"), "55555");

var r = new Windows.Storage.Streams.DataReader(clientSocket.InputStream);
await r.LoadAsync(4);
var res = r.ReadInt32();
clientSocket.Dispose();
System.Windows.MessageBox.Show(res.ToString(), "The Ultimate Question of Life, the Universe, and Everything", System.Windows.MessageBoxButton.OK);

OTHER TIPS

Is this something you are trying to do in code? What is your average file size - are we talking low-res 320x480 or HD-quality 720p+ video...? What are your limitations? (Time, Connectivity, etc)

You could set up Dropbox to do the transfer. The free version is limited in space (more if you share), but if you moved the files into and out of Dropbox as necessary then you'd at least be able to set it and forget about it. This would still require a network connection, so if you need to do this on the go it may not be a good answer.

If this is something you need to do while on vacation at Disney World or camping or something like that it may not be a viable option.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top