Ok ok.. Not quite Giga.. yet =)
But since Kim Dotcom owns Mega, i decided to go for Giga.
Reached 1.40MB/s transfer rate with the gigapush.com site on local network.
Some nasty bottlenecks so far are:
Chrome doesn’t support sending binary data, so bytebuffers have to be converted to string and then back at the opposite end. This takes a bit of time.
Can not send large packets, so, at the moment i have to split the files to 500ish byte chunks and add udp headers for each packet.
new Uint8List.fromList(new Uint8List.view(buffer).sublist(read, read+toRead));
Which was very slow.
I replaced that with a simplified home built version which gave me a speed boost of 100 KB/s.
There’s a bug for the sublist problem here https://code.google.com/p/dart/issues/detail?id=10354
Downloading the file after transfer is an issue also. At the moment i’m generating an object url for the finished download and use the html5 download attribute to set a filename and force download of the file. This sort of works, but consumes huge amounts of memory from the browser. Chromes filesystem api would be best solution but that works only on Chrome then.
Android issues. The object url download. This part does not work on Android version of Chrome. You can send files with the Chrome on Android, but receiving files will be a problem.
Bug for this here https://code.google.com/p/dart/issues/detail?id=8361
Signaling issues, Sometimes when both participants on same signaling channel quit at the same time, an exception is thrown and i haven’t managed to trace that yet.
ACK issues. I’m no Udp expert so i just went with the solution i thought would be cool. Currently i’m waiting that either 50 packets arrive or time since last arrived packet is 5 ms, then build a ACK packet containing the sequence numbers from the received packets and send that back to the sender. The sender will retransmit the packets if no ACK is received within some time which i can’t remember at the moment =). Not sure if there’s a better way.
Connectivity issues are also quite nasty. If both participants are behind a router which has symmetric NAT, the peer connection will fail.
From Norwegian operators at least Nextgentel and Get both offer a wireless router by default which has symmetric NAT. I’m using Get at home and had to replace the router with shop bought D-Link router.