Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

[RPC] to [ClientRpc]

Discussion in 'Multiplayer' started by perplex_bcn, Oct 1, 2015.

  1. perplex_bcn

    perplex_bcn

    Joined:
    Mar 1, 2013
    Posts:
    22
    Hi,

    I'm using RPC (networking legacy) in order to send data from a server(WebPlayer) to a client (Android) on a LAN. Server and client are at two completely different unity projects. There's only one C# file in common; the one with the RPC functions. I don't need any kind of synchronization, player spawning, etc. I just need to send chunks of data (always bigger than 64kb each) from the server to the client. It's working fine using the NetworkView component (which now is marked as deprecated).

    I would like to move to the new networking system. The manual says: 'ClientRpc calls are sent from objects on the server to objects on clients. They can be sent from any server object with a NetworkIdentity that has been spawned'. As I'm using different projects for server and client, I don't see how to match this requirement.

    I could use the NetworkTransport functionality, but the maximum size for sending is 2^16-1 bytes; I should need extra code to split the chunks in the server, and then the client should need to join the parts. With the RPC functionality this is transparent.

    So, is there any work-around in order to use the remote procedure calls with the new networking system in this context?

    Regards,
    Roberto.
     
    Last edited: Oct 1, 2015
  2. gfoot

    gfoot

    Joined:
    Jan 5, 2011
    Posts:
    550
    Those are huge packets - depending on the volatility of data, I would consider serving it from a CDN instead, e.g. over HTTP.

    But for an immediate solution I think you're correct that you should migrate to the NetworkTransport API, or just plain sockets. With plain sockets your server can listen on a TCP socket, clients can connect, and the server can just pump as much data into the socket as it feels like. PCs are good at buffering, and as a protocol TCP is highly optimized for throughput of large volumes of streamed data.
     
    perplex_bcn likes this.