Author Topic: [Solved] Failed to bind to Port  (Read 7427 times)

Offline arienlee

  • Newbie
  • *
  • Posts: 2
[Solved] Failed to bind to Port
« on: January 21, 2010, 01:54:27 pm »
Me and a friend are trying to setup a multiplayer game.  When I try to join his game, as soon as I hit Join multiplayer game I get an unhandled exception.

Looking in the UnhandledErrors.txt I find the following error;
1/20/2010 10:35:35 PM

1/21/2010 12:39:02 PM (3.0.0.0)
-----------------------------------Application_ThreadException-----------------------------------Lidgren.Network.NetException: Failed to bind to port 0 ---> System.PlatformNotSupportedException: This operation is only supported on Windows 2000 SP3 or later operating systems.
   at System.Security.Principal.SecurityIdentifier..ctor(WellKnownSidType sidType, SecurityIdentifier domainSid)
   at System.Diagnostics.SharedUtils.EnterMutexWithoutGlobal(String mutexName, Mutex& mutex)
   at System.Diagnostics.SharedPerformanceCounter.GetCounter(String counterName, String instanceName, Boolean enableReuse, PerformanceCounterInstanceLifetime lifetime)
   at System.Diagnostics.SharedPerformanceCounter..ctor(String catName, String counterName, String instanceName, PerformanceCounterInstanceLifetime lifetime)
   at System.Diagnostics.PerformanceCounter.Initialize()
   at System.Diagnostics.PerformanceCounter.set_RawValue(Int64 value)
   at System.Net.NetworkingPerfCounters.Initialize()
   at System.Net.Configuration.SettingsSectionInternal..ctor(SettingsSection section)
   at System.Net.Configuration.SettingsSectionInternal.get_Section()
   at System.Net.Sockets.Socket.InitializeSockets()
   at System.Net.Sockets.Socket..ctor(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
   at Lidgren.Network.NetBase.Start()
   --- End of inner exception stack trace ---
   at Lidgren.Network.NetBase.Start()
   at Lidgren.Network.NetDiscovery.DoSendDiscoveryRequest(IPEndPoint endPoint, Boolean useBroadcast, NetDiscoveryRequest request, Single interval, Single timeout)
   at Lidgren.Network.NetDiscovery.SendDiscoveryRequest(IPEndPoint endPoint, Boolean useBroadcast, Single interval, Single timeout)
   at Lidgren.Network.NetClient.DiscoverLocalServers(Int32 serverPort, Single interval, Single timeout)
   at AIWar.NetworkClientWrapper.StartServerDiscovery()
   at AIWar.Windows.FindLANGames.StartDiscovery()
   at AIWar.Windows.FindLANGames.StartDisplay()
   at AIWar.Windows.StartGame.btnFindLAN_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Label.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


We have tried connecting over the internet and on a LAN.  I have windows firewall turned off and currently no anti-virus software is running.  I have tried re-installing through steam (though I notice it doesn't ask me for the cd key after reinstall).  

Also when I try to host a game no error comes up, but I find the followed error int he NetworkServerErrors.txt;


-----------------------------------Sever Start Error-----------------------------------Lidgren.Network.NetException: Failed to bind to port 32320 ---> System.PlatformNotSupportedException: This operation is only supported on Windows 2000 SP3 or later operating systems.
   at System.Security.Principal.SecurityIdentifier..ctor(WellKnownSidType sidType, SecurityIdentifier domainSid)
   at System.Diagnostics.SharedUtils.EnterMutexWithoutGlobal(String mutexName, Mutex& mutex)
   at System.Diagnostics.SharedPerformanceCounter.GetCounter(String counterName, String instanceName, Boolean enableReuse, PerformanceCounterInstanceLifetime lifetime)
   at System.Diagnostics.SharedPerformanceCounter..ctor(String catName, String counterName, String instanceName, PerformanceCounterInstanceLifetime lifetime)
   at System.Diagnostics.PerformanceCounter.Initialize()
   at System.Diagnostics.PerformanceCounter.set_RawValue(Int64 value)
   at System.Net.NetworkingPerfCounters.Initialize()
   at System.Net.Configuration.SettingsSectionInternal..ctor(SettingsSection section)
   at System.Net.Configuration.SettingsSectionInternal.get_Section()
   at System.Net.Sockets.Socket.InitializeSockets()
   at System.Net.Sockets.Socket..ctor(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
   at Lidgren.Network.NetBase.Start()
   --- End of inner exception stack trace ---
   at Lidgren.Network.NetBase.Start()
   at AIWar.NetworkServerWrapper.StartServer()

I am running Vista64.

Also if I do a netstat -a -no to see what is running on what port I don't see port 32320 being used at all by any other applications.  I do notice that when my friend hosts a game and runs the netstat command he can see that port 32320 is being used by the game.



  

« Last Edit: January 21, 2010, 02:02:08 pm by x4000 »

Offline arienlee

  • Newbie
  • *
  • Posts: 2
Re: Failed to bind to Port
« Reply #1 on: January 21, 2010, 01:58:24 pm »
After trying to fix this problem for several hours, as soon as I posted the problem my friend figured it out.  I will post the solution in case anyone else has this issue.  The problem must be related to Vista's security or something.  While I tried to run the desktop shortcut in administrative mode during my troubleshooting, I had to set the acutal AIWar.exe to run as administrator and then launch the game from the exe.  Now Vista allows the game to set the port.  Weird.

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Failed to bind to Port
« Reply #2 on: January 21, 2010, 02:01:58 pm »
Thanks for posting the fix! I think that what must have happened is that Vista firewall was probably blocking this port.  Our installer opens it automatically, and usually Vista will give you a visual prompt to open the port if it is blocking it (I thought), but in this case your admin privileges apparently overrode that.  To get around this without having to run in admin mode, most likely all you need to do is go under the windows firewall settings in control panel and make sure that the AIWar.exe process allowed, and/or that you are allowing the port 32320.  Or, as you discovered, running in admin mode also should work.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

 

SMF spam blocked by CleanTalk