Forum General Empty response when joining room

Any issues or discussions relating to Unity development are welcome here.

Empty response when joining room

Postby MandeepYadav01 » June 28th, 2016, 8:07 am

Hello All,
First of all thanks to the PlayerIO team as they provided the best tool for networking but there is requirement of more documentation regarding Unity3d development. However I am able to work on it thanks to the people worked on it as they posted many things regarding everything.
I am having a problem regarding the joining room. I am calling a function CreateJoinRoom function to create and join the room. The good thing is I am able to connect to the server, after that able to create room and send the request of joining room. first I was not getting any response so found that there may be problem of firewall or router level so changed the network and I am good to go and solved that error but now I am getting response with error. The error describes itself that it's empty response but don't know how to solve as didn't found anything related. The error is

error = PlayerIOClient.PlayerIOError: NetworkIssue; receivedBytes == 0
UnityEngine.MonoBehaviour:print(Object)
PlayerIOConnect:<OnPlayPressed>m__6(PlayerIOError) (at Assets/Scripts/PlayerIOConnect.cs:102)
PlayerIOClient.Internal.identifier51:Execute()
PlayerIOClient.Internal.identifier52:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

Please help me in this.

Regards,
Mandeep Yadav
MandeepYadav01
 
Posts: 2
Joined: June 10th, 2016, 8:58 am

Re: Empty response when joining room

Postby ChristianD » July 1st, 2016, 3:05 am

Hi Mandeep,

Can you post a snippet of your code where this error happens?
Christian
ChristianD
.IO
 
Posts: 63
Joined: May 13th, 2016, 4:44 am

Re: Empty response when joining room

Postby MandeepYadav01 » July 8th, 2016, 6:40 am

Hello ChristianD,

Here is the code I am using.

Code: Select all
using UnityEngine;
using System.Collections;
using PlayerIOClient;
using UnityEngine.SceneManagement;
using System.Collections.Generic;

public class PlayerIOConnect : Singleton<PlayerIOConnect> {

   [HideInInspector]
   public Client client;
   public string GameId = "lines-heakioywn0ciqsygdehqua";
   public string ConnectionId = "Public";
   public string Name;
   public string PrefabName;

   public string UserId;


   string roomid;
   string roomType = "Lines_IO_Room";

   protected Connection pioconnection;
   public bool connected = false;
   public bool serverconnected = false;
   // Use this for initialization
   void Start ()
   {
      DontDestroyOnLoad (this.gameObject);
      UserId = GameManager.Instance.Name + Random.Range (0, 1000000000);

      PlayerIO.Connect (GameId, ConnectionId, UserId, "", null,
         delegate(Client _client) {
            print ("successfully connected to IO");
            client = _client;
            serverconnected = true;
            print ("Your user id is " + client.ConnectUserId);

         },
         delegate(PlayerIOError value) {
            print("error connecting the server = " + value);
         }
      );

}

   public void OnPlayPressed()
   {

      Debug.Log ("connecting");

      Dictionary<string, string> dict = new Dictionary<string, string>();
      dict.Add ("MaxPlayers", "1000");
      dict.Add ("Name","Lines_IO_Server");
      client.Multiplayer.CreateJoinRoom ("Lines_IO_Room1", "Lines_IO_Room", true,null,null,
      delegate(Connection Connection) {
            print("connected");
            ConnectionAttributes.connection = Connection;
            connected = true;
            SceneManager.LoadScene (1);
      },
      delegate(PlayerIOError ioError) {
         print ("error = "+ ioError);
      });
            
   }


   public void GenerateThePlayer()
   {
      if(SceneManager.GetActiveScene () == SceneManager.GetSceneAt (1))
      {
         CancelInvoke ();
         var obj = (GameObject)Instantiate (GameManager.Instance.PlayerPrefab, new Vector2 (Random.Range (-100, 100), Random.Range (-100,100)), Quaternion.identity);
         GameManager.Instance.SendMessage_PlayerIO ("Connected");
      }
   }
}
MandeepYadav01
 
Posts: 2
Joined: June 10th, 2016, 8:58 am

Re: Empty response when joining room

Postby ChristianD » July 15th, 2016, 4:05 pm

Are you trying to connect to a live server?

What happens when you try to connect to a local development server?

Network issues are always tricky, but I would interpret that error as if something on your network is stopping you from making the connection to the multiplayer server. The Connect method call results in an HTTP request, those usually go through all networks. The JoinRoom method opens a TCP socket, and there's a lot of networks that restrict that in various ways.

You can try setting the EndpointFilter to remove some common ports, it might be the case that your network does deep packet inspection of traffic on port 80, and when it sees it's not HTTP it kills the connection.

https://playerio.com/documentation/refe ... ointFilter
Christian
ChristianD
.IO
 
Posts: 63
Joined: May 13th, 2016, 4:44 am


Return to General



cron