HOW SHAREit WORKS?
Shareit is an awesome file transfer application.I have created a file sharing app myself. It’s all about networking concepts. There is a receiver and a sender. One of them creates a WiFi hotspot. And the other connects to it. Now a local network is formed. Both will have IP addresses. Now, the sender can select a file and then click send. The file is transferred through TCP and the receiver is identified by the IP address ( TCP – I m guessing it. It’s because when I tried UDP myself, many packets were lost. Many. )
Now, the high-speed part, well, the file is actually sent in chunks, and the progress is shown based on how much chunks are sent.Share It app optimizes the chunk size I suppose and I suppose it also optimizes on reading the file at sender side and writing file at the receiver side. I don’t know how. I m experimenting with it, for my app and have some extra features to add.
But I have created my app with simple concepts and I have achieved speeds up to 6 MB/s.And the maximum link speed when connected to an android hotspot, is usually 65 Mb/s which is about 8 MB/s ( note the ‘b’ and ‘B’. B – Byte. b – bit. ) , maybe there are devices which have better WiFi NIC cards that provide better maximum link speed. So, even if you utilise the full bandwidth, and send the file, it will be sent at about 8 MB/s speed. So, I think, in my app, even 6 MB/s is good. And the sharing speed is dependent on many factors! Here are a few that I found out based on my experiments ( so, basically, they are just theories. But I found good reason in the theories. ) :
- Link speed of the connection. Link speed differs based on the distance between the devices. I mean, it’s based on WiFi signal strength. That’s why I used the word “maximum” along with “link speed”.
- Reading speed of the internal storage or sd card, where ever the file is stored ( at sender side ) and Writing speed of the internal storage or sd card where ever the file is going to be stored ( at receiver side )
- Size of the chunks being sent
- How much bandwidth is being used by the app to send the file? It’s good if it’s able to utilise maximum bandwidth. It is because I found some stuff that can actually stop the app from using full bandwidth. Like, when a receiver connects to a sender’s hotspot, some of the apps in the receiver which are running in background, will detect this WiFi ( they detect whenever network state of the device is changed ) and think it’s an Internet connection and will try to send requests to their servers to get data for showing notifications, but only after trying to send a good amount of requests, it will understand that there is no Internet connection. And will stop trying to send requests. There will be many apps like this. For example Whatsapp, Hike, YouTube, etc. Since these requests are trying to be sent, it actually uses the bandwidth of the connection and our sharing app will not be able to use full bandwidth.
If you are an android app developer and you want to know how to code and stuff. First, you gotta learn socket programming in Java, and try them at PC level. Then learn how to implement network operations in Android, you can’t just put in the Java code that you tried in PC, you gotta use threads or services and do some extra stuff.