SharingService events aren't invoked?

DeanWinchDeanWinch
edited July 2017 in Questions And Answers

Academy 240 uses the Sharing Service, but assumes you connect on awake, and never disconnect. I want to have control over joining and leaving server/session/room, but it seems to be quite difficult with the existing Sharing Service. I wanted to share some of the problems I've run into, and see if I might be going about all of this in the wrong way.

There doesn't seem to be a clear distinction between the "server" which is where SharingService is running, and "Session List Server", which handles session connections. I eventually realized that the ServerSessionsTracker.ServerConnected event refers to the Session List Server, and not the "server". However, I keep getting into a state where I am connected to the server, and ServerSessionsTracker.ServerConnected is invoked, and yet SharingStage.Manager.SharingManagerConnected isn't invoked. This latter event should be invoked when the SharingManager is created and connected, presumably after the SharingStage.Connect() method. For the Session List Server to be connected, the SharingManager should also be connected? At one point, I was even connected to the Session List Server while SharingStage.IsConnected was false.

When it comes to disconnecting, I tried calling SharingManager.GetServerConnection().Disconnect(), but I don't know which event I can handle upon actually disconnecting. I tried ServerSessionsTracker.ServerDisconnected as well as NetworkConnectionAdapter.DisconnectedCallback, but neither seem to work for me.

I also ran into problems trying to manually connect again after disconnecting, getting this error: Failed to create incoming connection on port 20608. Error code: 6. It's an error from RakNet when failing to bind a socket, and for now it seems to be fixed by setting config.SetProfilerEnabled(false) in SharingStage.Connect().

When manually trying to leave a room, I sometimes get an AccessViolationException even when RoomManager().GetCurrentRoom() is true.

Using the AutoJoinSession script works for joining the first time, but when I leave the session, it doesn't update the local sessions list. Then when trying to join a second time, it thinks the room already exists (since it exists locally), and only joins the local session instead of creating a new session on the server.

There's a lot here, but I'm curious if anyone's tried to separately control server/session/room, and run into any of these problems?

Answers

  • I have the same question with you. sharemanager.GetServerConnection() is not invoked, and the connect is false. Do you solved the problem?

Sign In or Register to comment.