Why Does Unitywebrequest Return Unkown Error When I Do a Get Request on Linux

Why does UnityWebRequest return unkown error when I do a GET request on Linux?

Finally found the solution to the problem. (It only occurs on some Linux OS)

Unity only officially supports Ubuntu Linux, so it is looking (and failing to find) the certificate store where it would expect it to be. You can work around on Fedora by creating a symbolic link:

mkdir -p /etc/ssl/certs && ln -s /etc/pki/tls/certs/ca-bundle.crt /etc/ssl/certs/ca-certificates.crt

This is the source where I got it from: https://forum.unity.com/threads/ubuntu-headless-build-tls-handshake-fails.546704/

unknown error with the unitywebrequest function

Problem

You use the URL

http://localhost:3000/login

You are trying to send the web request to the host localhost. This works on your PC in Unity since the PC is the server you a trying to contact.

The server isn't running on your phone but your phone is trying to send the request to itself at port 3000 which will fail obviously.

Read more on What is a localhost?

Solution

Replace the localhost by the IP or network address your server/PC actually has and you should be fine.

To find out your PC's IP use e.g.

  • Linux/Unix: In a terminal call ifconfig
  • Windows: In the CMD call ipconfig

Ofcourse your PC and phone then also have to be in the same network or at least be routed so your phone can reach the server/PC at the given IP/network address.

Possible that you also have to configure your PC's firewall to allow incoming traffic on that port.

UnityWebRequest data is blank

I have fixed the issue.
Unity formats its data wildly different from PostMan, and my Flask server couldn't read it. Instead of using request.form[key] or request.data[key] in Flask, I found request.form.getlist(key) worked perfectly with both Postman's requests and Unity's.

UnityWebRequest not working in iOS

Found a solution. It turns out I had to specify in the Info.plist file that I want to allow "insecure" http connections for the iOS app.

<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>just-an-example.com</key>
<string></string>
</dict>
</dict>

How to get UnityWebRequest.GetAssetBundle content-length property?

If you look at the docs for UnityWebRequest.GetAssetBundle it doesn't send any other data in the header. It's a special request just for Assetbundles and being able to extract the data before they're completely downloaded.

This method creates a UnityWebRequest, sets the method to GET and sets the target URL to the string uri argument. Sets no other flags or custom headers.

https://docs.unity3d.com/ScriptReference/Networking.UnityWebRequest.GetAssetBundle.html

This method attaches a DownloadHandlerAssetBundle to the
UnityWebRequest. This DownloadHandler has a special
DownloadHandlerAssetBundle.assetBundle property, which can be used to
extract the asset bundle once enough data has been downloaded and
decoded to permit access to the resources inside the bundle.

Are you wanting the size to inform on download progress or are you displaying a download size for the user before they start a download?

for download progress if you create a Async loader AssetBundle.LoadAssetAsync, you have access to a progress property.

If informing the user, try using a standard UnityWebRequest and retrieve a full request header with the content-length. Then replace the UnityWebRequest.downloadHandler with the DownloadHandlerAssetBundle.assetBundle before beginning downloading? (I'm not sure on this part, but it's what I would try.)
Perhaps call a standard UnityWebRequest get the content length, then replace this standard UnityWebRequest with the GetAsset version?

Get Closest Date in php

You have a classic case of matching date value with a datetime field type. What you need is the earliest time value within the same date. Possibly your data contains multiple rows with data on same date but different time values. You should use the following:

SELECT schedule_date  FROM  schedule_table WHERE date(schedule_date) >= '2012-06-07' and   event_id='23' ORDER BY schedule_date ASC
LIMIT 1

The date() function is explained in MySQL documentation here.

Reasons for a 409/Conflict HTTP error when uploading a file to sharepoint using a .NET WebRequest?

Since no answers were posted, I found the following here:

The Web server (running the Web site) thinks that the request submitted by the client (e.g. your Web browser or our CheckUpDown robot) can not be completed because it conflicts with some rule already established. For example, you may get a 409 error if you try to upload a file to the Web server which is older than the one already there - resulting in a version control conflict.

Someone on a similar question right here on stackoverflow, said the answer was:

I've had this issue when I was referencing the url of the document
library and not the destination file itself.

i.e. try http://server name/document library name/new file name.doc

However I am 100% sure this was not my case, since I checked the WebRequest's URI property several times and the URI was complete with filename, and all the folders in the path existed on the sharepoint site.

Anyways, I hope this helps someone.



Related Topics



Leave a reply



Submit