Author Topic: Only able to open one connection at a time? Here's the solution...  (Read 17665 times)

Trevor

  • Jr. Member
  • **
  • Posts: 77
  • Karma: 2
    • View Profile
    • LackeyCCG: Play any CCG online
I was very perplexed about something that I figured out eventually. In case anyone else encounters the issue, here is what I discovered...

I have a game matching server hosting for clients to connect to, and then people can create games, tell others about them via the game matching server, and others can connect to those games with that data. I found that people who could connect to the server, for some reason, could not connect to one of those games. The game matching server functions essentially like a regular game host in the way people connect to it, so it didn't make sense that connecting to the server would work where connecting to a game would not. I then discovered that the same people who couldn't connect to games from the game matching server could connect directly if they bypassed the server. It turns out, they could only have one open connection at a time. If they were connected to the server they couldn't connect to the game host, and if they were connected to the game host, they couldn't connect to the server. And this only would happen for windows users (my game works on mac, linux, and windows).
The solution turned out to be something really annoying that some windows OS's do as a security "feature". They will only allow a program to open one connection unless you start the program with the right click menu and start it as an administrator. I think this happens in windows 7, but I'm not sure which versions of windows exactly employ this "security feature". It seems pretty dumb that they think 1 connection is safe, but more than 1 is a security threat.

I don't think I can disable that number of connections restrictions via my program's code. And it's very counterintuitive to have people always run my program as an administrator. It would be nice at least to be able to have my program tell if it is restricted in this way and at least alert people so they aren't as confused as I was.

Anyone else have any similar encounters with that windows "security feature"?
« Last Edit: October 27, 2010, 12:39:27 PM by Trevor »

Rak'kar

  • Administrator
  • Hero Member
  • *****
  • Posts: 6895
  • Karma: 291
    • View Profile
    • RakNet
Re: Only able to open one connection at a time? Here's the solution...
« Reply #1 on: October 27, 2010, 12:39:23 PM »
Wow, this is the first I've heard of that. UDP is connectionless, so if what you are pointing out is true then Windows must monitor outgoing datagrams to unknown IP addresses. I'm interested if you can verify for certain this is the case, because if so I'll have to add to the FAQ as a Windows feature-bug to look out for.

Trevor

  • Jr. Member
  • **
  • Posts: 77
  • Karma: 2
    • View Profile
    • LackeyCCG: Play any CCG online
Re: Only able to open one connection at a time? Here's the solution...
« Reply #2 on: October 27, 2010, 12:41:28 PM »
I just discovered this yesterday. I tested and confirmed that 2 connections are possible if, and only if, you start up the program as an administrator. The person who needed this step was running Windows 7.

Rak'kar

  • Administrator
  • Hero Member
  • *****
  • Posts: 6895
  • Karma: 291
    • View Profile
    • RakNet
Re: Only able to open one connection at a time? Here's the solution...
« Reply #3 on: October 27, 2010, 02:04:00 PM »
Do you know if there is a Microsoft support forum for Windows developers that we could confirm this with? It's such a huge flaw I want to make sure I know what versions of Windows it affects and if running as administrator is the only solution. If there's something that can be done programmatically inside RakNet I would prefer that.

Rak'kar

  • Administrator
  • Hero Member
  • *****
  • Posts: 6895
  • Karma: 291
    • View Profile
    • RakNet
Re: Only able to open one connection at a time? Here's the solution...
« Reply #4 on: October 27, 2010, 02:11:03 PM »
I posted it here. I don't know if this is the right place or not, or will get a response though
http://social.msdn.microsoft.com/Forums/en-US/windowsgeneraldevelopmentissues/thread/81e348e2-425b-4477-a4fc-d432b10f46a6

Trevor

  • Jr. Member
  • **
  • Posts: 77
  • Karma: 2
    • View Profile
    • LackeyCCG: Play any CCG online
Re: Only able to open one connection at a time? Here's the solution...
« Reply #5 on: October 27, 2010, 02:23:47 PM »
Do you know if there is a Microsoft support forum for Windows developers that we could confirm this with? It's such a huge flaw I want to make sure I know what versions of Windows it affects and if running as administrator is the only solution. If there's something that can be done programmatically inside RakNet I would prefer that.
My friend who told me about fixing it via the "run as admin" menu said a lot of programs are like that and it is something that is often complained about regarding Windows 7 (and possibly Vista). When I asked him what other programs do he said they just tell people to run them as an administrator. It seems too bad to be true, but that seems to be how things work in the windows world. I would like to think I'm just doing something dumb, but it appears to be systemic.

Have you tried testing it on your computer?

Rak'kar

  • Administrator
  • Hero Member
  • *****
  • Posts: 6895
  • Karma: 291
    • View Profile
    • RakNet
Re: Only able to open one connection at a time? Here's the solution...
« Reply #6 on: October 27, 2010, 05:33:50 PM »
No I didn't try testing it here. I'll wait a few days to see if the forum gets a response. If not I'll verify and add it to the FAQ as having no other solution.

OvermindDL1

  • Anti-Spam Moderator
  • Hero Member
  • ****
  • Posts: 855
  • Karma: 40
  • Programmer
    • View Profile
    • OvermindDL1's Site
Re: Only able to open one connection at a time? Here's the solution...
« Reply #7 on: October 27, 2010, 08:01:34 PM »
I have a Windows 7 computer here, if you can give me the code so I can compile and test it here I can confirm that or not.

Trevor

  • Jr. Member
  • **
  • Posts: 77
  • Karma: 2
    • View Profile
    • LackeyCCG: Play any CCG online
Re: Only able to open one connection at a time? Here's the solution...
« Reply #8 on: October 28, 2010, 01:27:13 AM »
I just installed windows 7 on my emulator, and I did not encounter that problem. I wonder if there was an update released that changed how things work. I will see if those encountering the need to "run as administrator" for multiple connections are missing some patches.

Trevor

  • Jr. Member
  • **
  • Posts: 77
  • Karma: 2
    • View Profile
    • LackeyCCG: Play any CCG online
Re: Only able to open one connection at a time? Here's the solution...
« Reply #9 on: October 28, 2010, 02:36:38 PM »
The people (running windows 7) who needed to run my program as an administrator in order to let it open multiple connections tested it for me. After they ran the windows operating system updater, they no longer needed to run as administrator.  So people who haven't updated may encounter this issue, and it is something programmers should be aware of. Apparently, Windows 7 initially had this restriction, and after a lot of complaints, I assume they removed the restriction in a subsequent patch.

Well, that solves that.

Rak'kar

  • Administrator
  • Hero Member
  • *****
  • Posts: 6895
  • Karma: 291
    • View Profile
    • RakNet
Re: Only able to open one connection at a time? Here's the solution...
« Reply #10 on: October 28, 2010, 03:19:51 PM »
Thanks for the update. I have added it to the FAQ and have also updated the FAQ since I see it is way out of date.