Search Unity

[RELEASED] File Transfer Server

Discussion in 'Assets and Asset Store' started by jemonsuarez, Oct 23, 2016.

  1. jemonsuarez

    jemonsuarez

    Joined:
    Sep 24, 2012
    Posts:
    151
    Do you need to transfer files between different devices? Now you can do it, and you don't have to install any dedicated server.

    File Transfer Server adds to your products the ability to transfer files from any supported platform to any supported platform. From mobile to standalone, mobile to mobile, etc.
    This is not a WWW wrapper or FTP server.

    Advantages:
    - Full source code available.
    - No plugins required.
    - Automatic FTS connected devices discover.
    - FileManagement asset included (at 50% of its original price).
    - Full documentation.
    - No need to install a dedicated server.
    - Fully configurable.
    - Event driven workflow.
    - Robust UDP asynchronous protocol.
    - Fail safe on losing connection (incomplete files are not saved).
    - Multi thread communications.
    - Multiple instances allowed.

    Supported platforms are:
    - Windows.
    - OSX.
    - Linux.
    - IOS. (100% supported, but Apple doesn't admits publication of TEST apps.)
    - Android.

    NOTE: This is a UDP communication protocol, so it may be used through internet with a fixed IP (No Proxy) or VPN.

    If you need any extra information or functionality please don’t hesitate on contacting me:
    jmonsuarez@gmail.com
     
    Last edited: Nov 25, 2016
  2. Stage64

    Stage64

    Joined:
    Jul 27, 2016
    Posts:
    11
    Does it work with newer Unity versions as 2019.1 or 2019.2?
     
  3. jemonsuarez

    jemonsuarez

    Joined:
    Sep 24, 2012
    Posts:
    151
    Hi @Stage672, yes it does.
    There is only one limitation: since WWW class is deprecated, the import of compressed audio files is temporarily unsupported. You can only load wav files.
    I’m working on a custom ogg vorbis decoder.
    If you need any other information or custom support, please contact me at jmonsuarez@gmail.com.
     
    Stage64 likes this.
  4. TRsiew

    TRsiew

    Joined:
    Jul 5, 2013
    Posts:
    13
    Hi , does it support WebGL ?
     
  5. jemonsuarez

    jemonsuarez

    Joined:
    Sep 24, 2012
    Posts:
    151
    Hi @TRsiew, at the moment the FTS only works with UDP communications, so WebGL is not supported.
     
  6. Arakjin

    Arakjin

    Joined:
    Nov 12, 2017
    Posts:
    10
    Hi
    Documentation is down, I was wondering how does this differentiate between devices?
     
  7. jemonsuarez

    jemonsuarez

    Joined:
    Sep 24, 2012
    Posts:
    151
    Hi @Arakjin here is the new documentation link (2.0). The old one is down because there is a new version under review process, and it may take a little to be available.

    In the current version there is no way to differentiate devices other than the IP address. But in the new version there are two new parameters that helps to identify the remote devices, they are:

    • name: A custom name set by you, like a readable label. It's managed as a string, so you can include more information along with the name.
    • OS: This an automatic string describing the OS, its version and platform. So you can differentiate between desktop and mobile devices.

    Hope have answered your question.
    If you need more information, please send me an email to jmonsuarez@gmail.com.

    Best regards.
     
  8. Arakjin

    Arakjin

    Joined:
    Nov 12, 2017
    Posts:
    10
    Thanks. that sounds like what I need.

    So if I buy File Transfer Server (legacy) it will be updated soonish? or will it be completely different asset?
     
  9. jemonsuarez

    jemonsuarez

    Joined:
    Sep 24, 2012
    Posts:
    151
    Hi @Arakjin, it'll be released as a major upgrade, so it's not compatible with the legacy version.

    But you can grab the new version for free during the grace days (one week) at launch if you already own the legacy version (you are saving almost the half of the final price this way).
    Hope FTS will be released this week, it has passed more than 15 days from submission.

    FTS also includes FileManagement, another asset that may be interesting for you.
    Best regards.
     
  10. Arakjin

    Arakjin

    Joined:
    Nov 12, 2017
    Posts:
    10
    Hi

    I'm having small problem with File Transfer Server

    since I don't want my app to always be findable by other users I disconnect FTS at void start()
    now this works fine on computer, but on android tablet, when I call fts.Connect() it freezes.
    Is there other way to do this or what might be the problem? also instead of ip, can I connect directly with device name?

    one more thing, is it possible to search shared folder of other device, or send just the file name to search to recipient
     
    Last edited: Jan 21, 2020
  11. jemonsuarez

    jemonsuarez

    Joined:
    Sep 24, 2012
    Posts:
    151
    Hi @Arakjin, thanks for using FTS.

    The right way to disconnect and connect the FTS is using its provided methods, so if it freezes in Android it chould be a bug. I'll take a look at that ASAP.

    Unfortunately, the device name is not a URL driven by a DNS, it's just a description label.
    Once you have the remote devices registered in the internal list, you can find them by "name" label, but you have to know that names may be duplicated and that may derive in unexpected behavior. The IP is safe, that's the right way to go.
    You can add devices manually to set your network (using some INI file to establish this settings, perhaps), so if you don't need to detect other devices you can stop sending this poll request.

    I would like to discuss more your needs about enable/disable FTS, because discovery may be disabled separately (at protocol level), no need to close the UDP port and open again (maybe this is the reason of your problem).
    Please send me an email to jmonsuarez@gmail.com

    Best regards.
     
  12. Lordmin

    Lordmin

    Joined:
    Mar 9, 2017
    Posts:
    62
    Hello! Please answer my questions.

    Can I transfer large mp4 files shot on mobile (Android/iOS) to PC (Windows 10) on the same network via UDP network system without server?
     
  13. jemonsuarez

    jemonsuarez

    Joined:
    Sep 24, 2012
    Posts:
    151
    Hi @Lordmin that’s exactly what FTS does: transfer files through UDP in the local network without dedicated servers (that’s not completely true, all devices are servers and clients simultaneously).
    I have to say that mobile devices performs worse than computers, so expect lower transfer rates as normal.
    I’ve achieved to transfer 1GB film from PC to PC in 15min (with transfer rates between 10 and 30 MB/s).
    Please don’t hesitate to ask if you need support.
     
  14. Stage64

    Stage64

    Joined:
    Jul 27, 2016
    Posts:
    11
    Hey @jemonsuarez the asset works perfectly on Windows however on Mac (Unity 2019/2020 and latest asset version) I always get the following error. The error appears when I enter a valid IP and if no IP is entered in the Inspector Unity freezes (on Win it works). Can you help?
     
  15. jemonsuarez

    jemonsuarez

    Joined:
    Sep 24, 2012
    Posts:
    151
    Hi @Stage64, thanks for the feedback.

    The error says that the IP is not possible to be applied to the current context, not that the IP is not valid. Maybe you are applying a IPV4 IP to an IPV6 connection?
    I'm not sure what can be happening, but please make sure that you run with enough administrator privileges.

    The OSX exported application has the same issues? Or just the editor?

    I'll try to reproduce your problem and get to you ASAP (Xcode is updating).
     
  16. Stage64

    Stage64

    Joined:
    Jul 27, 2016
    Posts:
    11
    I tested it on two different macs (Mojave and Catalina) with Admin rights.

    Error reproduction:
    - Create a new Unity Project (tested with Unity 2020.1.8f1, 2019.4.3f1, and .NET 2.0 and .NET 4.x)
    - Import asset (v2.2) open FTS_Test_Scene and press Play
    Result: The unity Editor freezes. If you build (Standalone MacOS) it the built app also freezes after opening.

    Optional step (editing the IP):
    - Under FTS_Test_Scene/ExampleUI/FileTransferServer edit the IP.
    Result: After pressing Play, the freeze is gone, however the Error appears. With the build its the same, no freeze, and error.
     
  17. jemonsuarez

    jemonsuarez

    Joined:
    Sep 24, 2012
    Posts:
    151
    Hi again @Stage64 I've found that the exploit I was using to detect the available Input/Output buffer in UDP is no longer working on those Unity versions, and it's freezing the application. I'm trying to find a workaround (If everything goes well the maximum buffer must be 65004 instead of 65536 as your console shows).
    Regarding the other problem we'll have to troubleshoot your network because I wasn't able to reproduce it in my system (I'm testing Unity 2019.4.12f1 on Catalina).
    Please send me an email at jmonsuarez@gmail.com in order to send you some fixed source code.
    Best regards.
     
    Last edited: Oct 21, 2020
  18. jemonsuarez

    jemonsuarez

    Joined:
    Sep 24, 2012
    Posts:
    151
    Just posting the result: the issue is fixed in the released 2.3 version of FTS.
    Thanks again @Stage64 for the feedback and testing.
     
  19. siowchenying

    siowchenying

    Joined:
    Oct 27, 2020
    Posts:
    5
    Hello, I have been playing around with your asset, but I seem to face an issue connecting this to a device. Does this support FTP server/client? If not, how does one suppose to connect a client to this server? Are you supposed to use two or more Unity app with this to connect with one another to transfer files?
     
  20. jemonsuarez

    jemonsuarez

    Joined:
    Sep 24, 2012
    Posts:
    151
    Hi @siowchenying, probably you missed that in the description it says hat FTS is not an FTP related asset (Names are too similar, it may case confusion).

    FTP uses TCP, and FTS uses UDP, that's the main reason you can't connect both. The other reason is that both are completely different protocols.

    Because UDP has strong limitations when working through the Internet, it's recommended to use it mainly in local networks. This way you'll get the best performance.

    UDP doesn't establishes connections, and the recommended way to use FTS is detecting the available devices in the local network.

    Nevertheless you can use FTS through the Internet (with performance loss depending on your internet connection/infrastructure), sending and receiving files targeting an URL instead of a local IP.
    Of course to allow FTS to work in an internet server it must be running somehow (just as FTP does, but FTS is not included with the OS as FTP is).

    FTS can be implemented in Unity, WindowsForms, WPF, Mono and Xamarin. All those platforms are C#.
    Please send me an email to jmonsuarez@gmail.com if you need more information and support.
    Best regards.
     
    siowchenying likes this.
  21. tomekkie2

    tomekkie2

    Joined:
    Jul 6, 2012
    Posts:
    973
    I am making an Android VR app for Oculus Quest.
    Would I be able to connect to network shares, browse network shares content, select and download files from them, using this asset?
     
    Last edited: Dec 17, 2020
  22. stlandbiz

    stlandbiz

    Joined:
    Dec 20, 2018
    Posts:
    3
    Do you have a video link to show us how to use the _FTS_TestScene?
     
  23. jemonsuarez

    jemonsuarez

    Joined:
    Sep 24, 2012
    Posts:
    151
    Hi @stlandbiz I don't, I really didn't expected that to be necessary, but I can make a quick video showing how it works.
    Do you need help with some particular feature? Please send me an email to jmonsuarez@gmail.com
    Best regards.
     
  24. stlandbiz

    stlandbiz

    Joined:
    Dec 20, 2018
    Posts:
    3
    Hi, I have built the _FTS_TestScene in UWP for PC A and PC B. I try to connect from PC A to PC B but they are unable to communicate with each other. I was unsure whether is my step wrong or it cannot be communicate in UWP build.
     
  25. jemonsuarez

    jemonsuarez

    Joined:
    Sep 24, 2012
    Posts:
    151
    Hi @stlandbiz, unfortunately the UWP platform is not supported by FTS (probably you missed it in description).
    At the moment, I can't say when I'll be able to extend the compatibility because there are so many namespaces not available in this particular platform (System.IO, Thread, Socket, etc.)
    Best regards.
     
  26. losingisfun

    losingisfun

    Joined:
    May 26, 2016
    Posts:
    36
    Hey @jemonsuarez I have a unique situation where I’d like to implement FTS to transfer files I’m using to load scenes in a game between hosts and clients for a multiplayer session.

    I don’t necessarily need to write the files to disk, and it’s mostly json and some png files. I’m wondering is there an easy way I could intercept the download and just get the downloaded files straight into memory so I can handle deserializing them myself? Or does it stream them straight to disk and I’d need to use an IO operation to retrieve it manually?

    I don’t know if this is how FTS was intended to be used but it could save me a lot of trouble if I can use this for initializing my multiplayer sessions. As you probably know a NetworkTransport isn’t good for file transfers. Do you foresee any issues in using it like this?

    EDIT: I'm also wondering is there any solution for natpunch or port forwading?
     
    Last edited: Aug 31, 2021
  27. jemonsuarez

    jemonsuarez

    Joined:
    Sep 24, 2012
    Posts:
    151
    Hi @losingisfun, what you are describing sounds like a custom data dialog, and that is always best achieved with direct communications (UDP, TCP or WebSocket). I recommend you to take a look at SocketsUnderControl, maybe that fits better your needs.

    FTS is intended to pick a file and send it through UDP adding the control of fragmentation, then with successive updates, it evolved to something way more complex. The main objective was to be able to send large files and get its status in real-time.
    Intercepting the FST internals may not be a good idea just because it's not intended to work that way, so it may not behave as expected.

    You need to send small packages, so the real-time status can be neglected, then the best way to send your data in a "memory-to-memory" way is using TCP or WebSocket.

    I highly recommend WebSockets vs TCP, it's a bit slower but it handles the fragmentation way much better (extremely useful for internet connections) and it's also compatible with WebGL.

    If you need more information please send me an email to jmonsuarez@gmail.com
     
  28. Legendary_keith

    Legendary_keith

    Joined:
    Apr 21, 2015
    Posts:
    20
    Hello @jemonsuarez ,

    Can i send files to another person in a multiplayer app?
    I'm making a social app and want to be able send pictures ,videos ,GLTF files to other players across the world.
    Is that possible with this asset?

    Thanks in advance,

    Keith
     
  29. jemonsuarez

    jemonsuarez

    Joined:
    Sep 24, 2012
    Posts:
    151
    Hi @Legendary_keith , sending files through the internet may be difficult even using FTS, transferring files locally is way much easier.
    The short answer is yes you can, but you need to know how to route messages between those devices.

    The easy way is to upload files from a device (even through a NAT server) to an internet server, and then download those files from another remote device, requesting them to that same internet server (so using the server as intermediary).

    If you are trying to transfer files from two devices directly (P2P) you also can do it, but you need some high knowledge in networking in order to establish the UDP channel between both.

    Unfortunately there is not automatic way to establish a P2P channel, you have to do it yourself (please check the SUC documentation, read the UDP section in page 13 if you don't know what I'm talking about). You also need an internet server to establish a P2P channel between two remote devices.

    Best regards.
     
  30. oOZerOo

    oOZerOo

    Joined:
    Mar 1, 2011
    Posts:
    12
    how can I to test upload file and download by one component computer
     
  31. oOZerOo

    oOZerOo

    Joined:
    Mar 1, 2011
    Posts:
    12
    I need to know,how to setup up the file transfer server,can make a video?
     
  32. dongyu1122

    dongyu1122

    Joined:
    May 31, 2021
    Posts:
    1
    Please make a video to demonstrate the whole process. Thank you
     
  33. jemonsuarez

    jemonsuarez

    Joined:
    Sep 24, 2012
    Posts:
    151
    Hi, I'm not good at making videos.
    While I find the time to make it, here are the steps to use FTS:

    1 - Install the test app in two or more devices.
    2 - Go to screen 2/9 (on any of them) and click "Check status" a few times.
    3 - Check the drop down "Devices list" to see if the other device appears there.
    4 - Go to screen 4/9 and click "Download text file" or "Download Image" button.
    5 - Check status and emergent messages in both devices to check the status of the transference.

    Every other screens are different options/modes of this same feature.
     
  34. jenlinginstamedia

    jenlinginstamedia

    Joined:
    Apr 4, 2022
    Posts:
    1
    Hey amazing plugin, quick question. I can get a success rate of roughly 90%? Some of the uploads will end up in "TimeOut". What are the factors and what can I do to make it more stable?
     
  35. jemonsuarez

    jemonsuarez

    Joined:
    Sep 24, 2012
    Posts:
    151
    Hi, unfortunately with UDP there isn't a single answer or a single reason.
    The "timeout" event means that the FTS has retried several times to request a file/chunk without success, which implies that the target is unreachable.

    I can name a few possible reasons:
    - Too many simultaneous downloads (messages being dropped automatically by the network).
    - One of both devices is temporarily disconnected. Unlike TCP or WebSocket, there is no "disconnection" event in UDP.
    - Wifi device too far from any antenna.
    - NAT server blocking messages.
    - Too much traffic in the network (UDP messages can be dropped easily in this situation).

    Please send me an email to jmonsuarez@gmail.com if you have information to help you get a more accurate diagnostic.
     
  36. eagleeyez

    eagleeyez

    Joined:
    Mar 21, 2013
    Posts:
    406
    tried the windows demo and the android demo and all works fine. So does this mean I could make a small camera app on my android and then have that image sent to my windows unity test app? Can the image be large?
     
  37. jemonsuarez

    jemonsuarez

    Joined:
    Sep 24, 2012
    Posts:
    151
    Hi, FTS transfer files, not video.
    If you application saves a file and then sends or allows other devices to request that file, then yes, it's possible, but don't expect a real time video streaming because that's not the main purpose of this asset.

    Large files are supported between standalone builds only. You can send files up to approximately 2GB (a few bytes less than that) on any other platform.

    Please send me an email to jmonsuarez@gmail.com if you need further information.

    Best regards.
     
  38. Stage64

    Stage64

    Joined:
    Jul 27, 2016
    Posts:
    11
    Hi @jemonsuarez, after using your asset for more than 3+ years, I am still loving it! Thanks for that and all the updates in that time.

    My question would be if you would have any tips on how to increase the transfer speed. Currently, I only get transfer rates between 0.2Mb/s - 0.3Mb/s. It used to be much higher, like you mention in the documentation > 3Mb/s.

    I am using it between a Mac and Windows Standalone and Unity 2021.3.11f1
     
  39. jemonsuarez

    jemonsuarez

    Joined:
    Sep 24, 2012
    Posts:
    151
    Hi @Stage64, thanks for using FTS.
    As you already noticed, 0.3MB/s is too slow even for mobile devices.

    Normally Apple computers allows 8KB buffer for UDP, and you have to increase that size manually by setting the ChunkSize in the FTS class. The recommended size is about 64KB (nowadays it's rare to have hardware not supporting that buffer size). Make sure to increase the ChunkSize in both sides, or the transference will be performed choosing the tiniest.

    The other reason that I think of is when sending files through the internet using a connection with a 1.4KB MTU. If this is your problem, unfortunately there is no solution other than using a better connection that allows "jumbo" messages.

    Hope it helps,
    best regards.
     
    Last edited: Apr 12, 2023
  40. Stage64

    Stage64

    Joined:
    Jul 27, 2016
    Posts:
    11
    Thank you for the fast response. It worked — fixing the _chunkSize value to 65536 in the my FileTransferServer script.
     
    jemonsuarez likes this.