question

Michal Töpfer avatar image
Michal Töpfer asked

HttpWebRequest exception when no connection (Unity SDK)

I played with PlayFab settings a bit and tried using HttpWebRequest and I realized that when you don't have a connection, it throws an exception (details below). While when using UnityWWW it runs the errorCallback (Action<PlayFabError>), which seems better to me.

So the question is: Is it a bug or feature? I mean if I wanted to use HttpWebRequest, do I need to run this in a try block and handle the errors in catch or are you going to handle the exception in SDK and call the errorCallback (as the UnityWWW version does)?

Exception:

SocketException: An existing connection was forcibly closed by the remote host


System.Net.Sockets.Socket+SocketAsyncResult.CheckIfThrowDelayedException ()
System.Net.Sockets.Socket.EndReceive (IAsyncResult asyncResult, System.Net.Sockets.SocketError& errorCode)
System.Net.Sockets.Socket.EndReceive (IAsyncResult result)
System.Net.Sockets.NetworkStream.EndRead (IAsyncResult ar)
Rethrow as IOException: EndRead failure
System.Net.Sockets.NetworkStream.EndRead (IAsyncResult ar)
Mono.Security.Protocol.Tls.SslStreamBase.InternalReadCallback (IAsyncResult result)
Rethrow as WebException: Error getting response stream (ReadDone1): ReceiveFailure
System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult)
System.Net.HttpWebRequest.GetResponse ()
PlayFab.Internal.PlayFabWebRequest.ProcessHttpResponse (PlayFab.Internal.CallRequestContainer reqContainer) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:269)
UnityEngine.Debug:LogException(Exception)
PlayFab.Internal.PlayFabWebRequest:ProcessHttpResponse(CallRequestContainer) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:304)
PlayFab.Internal.PlayFabWebRequest:WorkerThreadMainLoop() (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:152)
sdks
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
1807605288 avatar image
1807605288 answered

Coincidentally, I also discovered this issue last week.

The intended behavior is that you should get an error callback describing the error, not an exception.

I fixed the issue internally last week, so you should see the fix go live later today.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Error rendering WebPanel (widgets/consolidation-widget.ftl): org.hibernate.hql.internal.ast.QuerySyntaxException: AvailableConsolidation is not mapped [from AvailableConsolidation up where up.node = :node]