Quantcast
Channel: Questions in topic: "webrequest"
Viewing all articles
Browse latest Browse all 387

Re-using a buffer for posting variable-length data to a web server?

$
0
0
I'm trying to find a way to minimize allocations and GC hitches when creating large web requests with a bounded but unknown size. Ideally, I would like to preallocate an array of `byte`s, fill the buffer before making a request, and then specify which region of the buffer to send. `UploadHandlerRaw` seems promising (https://docs.unity3d.com/ScriptReference/Networking.UploadHandlerRaw-ctor.html) but, unless I'm missing something, it doesn't seem to provide a way to use less than the entire buffer size. **Is there a way to create a custom `UploadHandler` without this limitation? Are there any alternatives (must work at least on Android and iOS) to `UploadHandlerRaw` that don't have its limitations?** ----- For context, I need to send json requests that include an arbitrary but bounded amount of base-64 encoded data (a user-specified region of an image). Their destination is a 3rd party server that will send back a variable-length response, so I don't have control of the data format.

Viewing all articles
Browse latest Browse all 387

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>