HttpWebRequest(Response) sometimes crashes Photon totally
Options
Hello.. sorry for the question spams, but there are some milestones I cannot get over..
So I have this function(this web request)
This web request needs to be sent frequently so that I update my friends list.. from time to time the streamreader freezes for like 1-2 minutes then it returns only "{" this as a response text and both Photon and Photon Chat disconnect.. and strangely I cannot connect again to them.. There seems to be no connection between this function and photon chat/ photon server whatsoever.. I don't understand why this crashes photon as well - I can't connect to the servers after that again though...
So I have this function(this web request)
HttpWebRequest someRequest = HttpWebRequest.Create (URL) as HttpWebRequest;
someRequest.ContentType = "application/json; charset=utf-8";
someRequest.Method = "POST";
someRequest.ClientCertificates.Add (client);
using (var streamWriter = new StreamWriter(someRequest.GetRequestStream())) {
streamWriter.Write (JsonString);
streamWriter.Flush ();
}
someRequest.AuthenticationLevel = System.Net.Security.AuthenticationLevel.MutualAuthRequired;
try
{
HttpWebResponse response = someRequest.GetResponse () as HttpWebResponse;
Debug.Log("Server: "+response.Server);
string responseText = "";
using (Stream responseStream = response.GetResponseStream())
{
StreamReader reader = new StreamReader(responseStream);
responseText = reader.ReadToEnd();
//we tried it- it didn't help!! we left it just in case
reader.Close();
reader.Dispose();
responseStream.Close();
responseStream.Dispose();
}
response.Close ();
Debug.Log("Response text is: " + responseText);
//parsing and creating the list
ParseServerFBIDs (responseText);
}
catch(WebException a)
{
if(a.Status == WebExceptionStatus.Timeout)
{
ConnectToNetworks();
if(brFBFriends > 0)
{
RetreiveFriendsInstalledTheGame();
brFBFriends = brFBFriends - 1;
}
else
{
Debug.Log("There seems to be a problem with the connection");
brFBFriends = 2;
}
}
}
This web request needs to be sent frequently so that I update my friends list.. from time to time the streamreader freezes for like 1-2 minutes then it returns only "{" this as a response text and both Photon and Photon Chat disconnect.. and strangely I cannot connect again to them.. There seems to be no connection between this function and photon chat/ photon server whatsoever.. I don't understand why this crashes photon as well - I can't connect to the servers after that again though...
0
Answers
-
Hi,
Why you think that this crashes Photon? Soon after application gets frozen, Photon server disconnects clients because of timeout.
What is in log when you trying to reconnect?0 -
What is value of photon server timeout?0