Author Topic: Unable To Connect  (Read 3999 times)

raptorx81

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 12
    • View Profile
Unable To Connect
« on: October 01, 2015, 01:29:56 PM »
I'm running into a bit of a strange issue with TNet. When I try to join a game server I get an error that states "Unable to connect : The object was used after being disposed".

This is happening on a console platform, so I can't divulge too much information. TNet works flawlessly on PC and the other consoles I'm targeting. Does anyone have any tips or ideas as to why this is happening?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Unable To Connect
« Reply #1 on: October 01, 2015, 01:37:08 PM »
You will need to give a lot more details than that, such which line of the code you are getting an error in at least. You can also try commenting out #define MULTI_THREADED in TNGameServer.cs to make it single-threaded to see if that helps.

raptorx81

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 12
    • View Profile
Re: Unable To Connect
« Reply #2 on: October 01, 2015, 01:48:45 PM »
Sorry I'll try to explain a bit more. So the game immediately connects to a UDP lobby server when it starts up(which works fine on this particular platform). When I select a server the following gets called ..

TNManager.Connect(someserveraddress);

Then after about 5 seconds or so the OnNetworkConnect event fires, the success boolean is false and the error message is what I mentioned above.

So pretty straight forward. I'll try commenting out the #define you mentioned later. Will that make a difference though if it's in TNGameServer.cs? (At the moment I'm simply joining a standalone server). I don't have access to my project right now so I'm just thinking out loud.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Unable To Connect
« Reply #3 on: October 01, 2015, 08:52:20 PM »
Sounds like the connection attempt is simply not successful. Try connecting to the server via the web browser. Just use the address prefixed with http://address:port

No data received = success. Everything else = failure.

raptorx81

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 12
    • View Profile
Re: Unable To Connect
« Reply #4 on: October 01, 2015, 10:04:52 PM »
Yes that's what I initially thought as well, but I have my game running on a variety of platforms without any problems at all. Every platform can connect to my standalone development server immediately. (I can connect via web browser and regular standalone builds without a problem).

And the reason I think something else might be up is that when you fail to connect to a server on Windows (or any platform for that matter) - you get the error message "Unable to connect". That's it. However on the platform in question, the error is "The object was used after being disposed". So I'm scratching my head  ??? , I'm not quite sure where to start looking.
« Last Edit: October 01, 2015, 10:26:00 PM by raptorx81 »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Unable To Connect
« Reply #5 on: October 03, 2015, 06:51:57 PM »
If that message was related, you would get it right away after calling Connect. The fact that it waits a few seconds tells me that it tries to establish a connection and fails. You can try doing a raw TCP socket yourself and trying to have it connect with the same address to see what happens.

raptorx81

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 12
    • View Profile
Re: Unable To Connect
« Reply #6 on: October 12, 2015, 02:29:59 AM »
Yeah I suspect that it's not a TNet issue directly and might be a socket bug for this particular platform. I'll continue digging and if I notice it's a TNet bug I'll update this thread. Thanks again!