2

string SerializedFileString contains a serialized file, potentially hundreds of MB in size. The server tries to copy it into the client's local string ClientSideSerializedFileString. Too good to be true, which is why it throws an exception. Is there a Mirror-way to do this?

[TargetRpc]
private void TargetSendFile(NetworkConnection target, string SerializedFileString)
{
    if (!hasAuthority) { return; }
    ClientSideSerializedFileString = SerializedFileString;
}

ArgumentException The output byte buffer is too small to contain the encoded data, encoding 'Unicode (UTF-8)' fallback 'System.Text.EncoderExceptionFallback'.

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
jkbx
  • 414
  • 1
  • 6
  • 21
  • Split into chunks I suppose... – aybe Jun 04 '21 at 14:10
  • Possible, but then the sequential arrival can't be guaranteed without further code around that. – jkbx Jun 04 '21 at 14:19
  • I guess then you need the required code around it ;) split into packages, number them, wait until all are received in correct order .. eventually request lost packages again ... though that's basically the TCP protocol ;) – derHugo Jun 04 '21 at 15:32
  • Probably related https://stackoverflow.com/questions/49157832/unity-send-huge-file-over-networking – derHugo Jun 04 '21 at 15:36
  • I checked that. It seems like using Mirror is very slow in that regard. Others also suggest using TCP directly. – jkbx Jun 07 '21 at 06:41

0 Answers0