Search Unity

SocketException: An attempt was made to access a socket in a way forbidden by its access permissions

Discussion in 'Editor & General Support' started by Rodolfo-Rubens, Jan 29, 2016.

  1. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,197
    After upgrading to Unity 5.3.2p1 I started getting this error everytime I try to enter play mode and when I save my script in Visual Studio:
    Code (csharp):
    1. SocketException: An attempt was made to access a socket in a way forbidden by its access permissions.
    2. System.Net.Sockets.Socket.Bind(System.Net.EndPoint local_end)
    3. SyntaxTree.VisualStudio.Unity.Messaging.UdpSocket.Bind(System.Net.IPAddress address,Int32 port)
    4. SyntaxTree.VisualStudio.Unity.Messaging.Messager..ctor (Int32 port)
    5. SyntaxTree.VisualStudio.Unity.Messaging.Messager.BindTo(Int32 port)
    6. SyntaxTree.VisualStudio.Unity.Bridge.VisualStudioIntegration+<>c__DisplayClass3.<.cctor>b__1 ()
    7. SyntaxTree.VisualStudio.Unity.Bridge.Project+<>c__DisplayClass4.<RunOnceOnUpdate>b__3 ()
    8. UnityEditor.EditorApplication.Internal_CallUpdateFunctions()(at C:/buildslave/unity/build/artifacts/generated/common/editor/EditorApplicationBindings.gen.cs:270)
    The only other thing I found about this had no answers so I decided to post here:
    http://answers.unity3d.com/questions/1094080/socket-errors-with-visual-studio-integration.html

    Any ideas?
     
  2. Crucible1

    Crucible1

    Joined:
    Dec 23, 2015
    Posts:
    6
    I have this too! If you find out anything it would be great to hear about it
     
  3. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,838
    It's funny because I've been using unity for a year, and yet just today this error appeared for the very first time. I re-booted my computer and now everything is fine.
    It must be something went wrong at the Unity server's end.

    socket.jpg
    j
     
  4. uzairamirs

    uzairamirs

    Joined:
    Jan 7, 2015
    Posts:
    8
    Hi everyone, yes this post is old but my solution might help someone. I have windows 7, 64 bit and Unity5.3, I had the same problem when I imported VR SDK for Unity and just restarted Unity and my problem was solved.
     
    iwkio likes this.
  5. dogzerx2

    dogzerx2

    Joined:
    Dec 27, 2009
    Posts:
    3,971
    I got this problem in a silly fashion.

    I copied a component from the prefab and pasted it to another prefab.

    Better to drop both prefabs on scene, then copy the component from one to another. And apply.
     
  6. The-NightflyAZ

    The-NightflyAZ

    Joined:
    Apr 27, 2015
    Posts:
    17
    Did you enable developer mode AND enable USB debugging in the developer mode options? I had the same error and after I enabled them both the error was cleared.
     
  7. The_Natural_Tanuki

    The_Natural_Tanuki

    Joined:
    Oct 14, 2015
    Posts:
    6
    Got this today when accessing from a VPN, restarted Unity, it didn't occur again.
     
  8. wiseneutron

    wiseneutron

    Joined:
    Nov 1, 2018
    Posts:
    1
    Fixed it with try-catch blocks.
     
  9. tigme

    tigme

    Joined:
    Jul 1, 2014
    Posts:
    37
    Fixed the error by restarting Unity IDE
     
  10. ow1

    ow1

    Joined:
    Nov 9, 2018
    Posts:
    4
  11. ow1

    ow1

    Joined:
    Nov 9, 2018
    Posts:
    4
  12. ow1

    ow1

    Joined:
    Nov 9, 2018
    Posts:
    4
    The real reason in my case is that the firewall of Windows blocked UnityEditor from Private network. After I deleted the rules in the firewall, this error is gone (don't need to run as administrator). Hope this info can help u
     
  13. TeotiGraphix

    TeotiGraphix

    Joined:
    Jan 11, 2011
    Posts:
    145
    I had this same problem and it turned out to be my ports were reversed. I also did add private to the Editor.exe in Windows Firewall as ow1 mentioned, thanks!
     
  14. zetaFairlight

    zetaFairlight

    Joined:
    Apr 26, 2018
    Posts:
    14
    I have the same problem... I'm facing too many errors by just opening the editor.
     
  15. JustAnotherDude

    JustAnotherDude

    Joined:
    Oct 28, 2013
    Posts:
    279
    Yeah just started happening on 2019.1.10f1


    Code (CSharp):
    1. SocketException: An attempt was made to access a socket in a way forbidden by its access permissions.
    2.  
    3.  
    4. System.Net.Sockets.Socket.Bind (System.Net.EndPoint localEP) (at <0079a30f96a047348857e1cecc6c638a>:0)
    5. SyntaxTree.VisualStudio.Unity.Messaging.UdpSocket.Bind (System.Net.IPAddress address, System.Int32 port) (at <9fd114e9c70e427598a8b954cdc465ee>:0)
    6. SyntaxTree.VisualStudio.Unity.Messaging.Messager..ctor (System.Int32 port) (at <9fd114e9c70e427598a8b954cdc465ee>:0)
    7. SyntaxTree.VisualStudio.Unity.Messaging.Messager.BindTo (System.Int32 port) (at <9fd114e9c70e427598a8b954cdc465ee>:0)
    8. SyntaxTree.VisualStudio.Unity.Bridge.VisualStudioIntegration+<>c.<.cctor>b__4_0 () (at <79234f8f29df43aebfb69f10ebb06c54>:0)
    9. SyntaxTree.VisualStudio.Unity.Bridge.Project+<>c__DisplayClass40_0.<RunOnceOnUpdate>b__0 () (at <79234f8f29df43aebfb69f10ebb06c54>:0)
    10. UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/Editor/Mono/EditorApplication.cs:200)
    11.  
    Restarting editor does fixes it.
     
  16. chris73it

    chris73it

    Joined:
    Oct 15, 2013
    Posts:
    21
    Same here: installed 2019.2.0f1 and now I am getting this error.
     
  17. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    623
    I have this too in 2019.2.1
    Code (CSharp):
    1. SocketException: An attempt was made to access a socket in a way forbidden by its access permissions.
    2.  
    3. System.Net.Sockets.Socket.Bind (System.Net.EndPoint localEP) (at <376e8c39bbab4f1193a569c8dbe4305c>:0)
    4. SyntaxTree.VisualStudio.Unity.Messaging.UdpSocket.Bind (System.Net.IPAddress address, System.Int32 port) (at <7bfe50ea87ae444bb97944401234ceb7>:0)
    5. SyntaxTree.VisualStudio.Unity.Messaging.Messager..ctor (System.Int32 port) (at <7bfe50ea87ae444bb97944401234ceb7>:0)
    6. SyntaxTree.VisualStudio.Unity.Messaging.Messager.BindTo (System.Int32 port) (at <7bfe50ea87ae444bb97944401234ceb7>:0)
    7. SyntaxTree.VisualStudio.Unity.Bridge.VisualStudioIntegration+<>c__DisplayClass9_0.<.cctor>b__0 () (at <843b7c5ab4d34b2491669c24f4d94522>:0)
    8. SyntaxTree.VisualStudio.Unity.Bridge.Project+<>c__DisplayClass40_0.<RunOnceOnUpdate>b__0 () (at <843b7c5ab4d34b2491669c24f4d94522>:0)
    9. UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/Editor/Mono/EditorApplication.cs:303)
     
  18. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    623
    I have the feeling Unity is building on bugs and just ads new features.
     
    Deon-Cadme likes this.
  19. seandanger

    seandanger

    Joined:
    Jun 13, 2012
    Posts:
    39
    I'm getting this error too, and I understand being frustrated, but that's a silly assertion. Take a look at their issue tracker, about 18,000 fixed bugs listed there.
     
  20. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    623
    It not only this. Its also other silly bugs stuck from 2018 like this one.
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEditor.Graphs.Edge.WakeUp () (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Edge.cs:114)
    3. UnityEditor.Graphs.Graph.DoWakeUpEdges (System.Collections.Generic.List`1[T] inEdges, System.Collections.Generic.List`1[T] ok, System.Collections.Generic.List`1[T] error, System.Boolean inEdgesUsedToBeValid) (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:387)
    4. UnityEditor.Graphs.Graph.WakeUpEdges (System.Boolean clearSlotEdges) (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:286)
    5. UnityEditor.Graphs.Graph.WakeUp (System.Boolean force) (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:272)
    6. UnityEditor.Graphs.Graph.WakeUp () (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:250)
    7. UnityEditor.Graphs.Graph.OnEnable () (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:245)
     
  21. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    623
    This loses the animator and make me restart the Editor every time.
     
  22. Domas_L

    Domas_L

    Unity Technologies

    Joined:
    Nov 27, 2018
    Posts:
    111
    Hello! If you are still having issues and can't find anything similar to it on the IssueTracker, could you please submit a bug report with a minimal reproduction project for this issue and reply in here with the issue ID?
     
  23. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    623
    I will send you the ID but I wont send you the project. I dont know how to reproduce them both.
     
  24. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    623
    Case 1179823
     
  25. Lars-Blaabjerg

    Lars-Blaabjerg

    Joined:
    Apr 5, 2011
    Posts:
    54
    I get it too :-(

    Code (CSharp):
    1. SocketException: An attempt was made to access a socket in a way forbidden by its access permissions.
    2.  
    3.   at System.Net.Sockets.Socket.Bind (System.Net.EndPoint localEP) [0x00043] in <376e8c39bbab4f1193a569c8dbe4305c>:0
    4.   at SyntaxTree.VisualStudio.Unity.Messaging.UdpSocket.Bind (System.Net.IPAddress address, System.Int32 port) [0x00011] in <7bfe50ea87ae444bb97944401234ceb7>:0
    5.   at SyntaxTree.VisualStudio.Unity.Messaging.Messager..ctor (System.Int32 port) [0x00041] in <7bfe50ea87ae444bb97944401234ceb7>:0
    6.   at SyntaxTree.VisualStudio.Unity.Messaging.Messager.BindTo (System.Int32 port) [0x00000] in <7bfe50ea87ae444bb97944401234ceb7>:0
    7.   at SyntaxTree.VisualStudio.Unity.Bridge.VisualStudioIntegration+<>c__DisplayClass9_0.<.cctor>b__0 () [0x00017] in <843b7c5ab4d34b2491669c24f4d94522>:0
    8.   at SyntaxTree.VisualStudio.Unity.Bridge.Project+<>c__DisplayClass40_0.<RunOnceOnUpdate>b__0 () [0x0001a] in <843b7c5ab4d34b2491669c24f4d94522>:0
    9.   at (wrapper delegate-invoke) <Module>.invoke_void()
    10.   at UnityEditor.EditorApplication.Internal_CallUpdateFunctions () [0x00010] in C:\buildslave\unity\build\Editor\Mono\EditorApplication.cs:303
    11.  
     
  26. levwsr

    levwsr

    Joined:
    Jul 23, 2012
    Posts:
    68
    I got this too. Got rid of it by turning off "editor attaching" in preferences.
    Using beta 2019.3.0b9
    have VS 2017 and 2019 installed, happens with both
     
  27. stefan_furcht

    stefan_furcht

    Joined:
    Feb 10, 2017
    Posts:
    10
    Same here with 2019.2.12f1.
    Disabling "Editor Attaching" does fix it indeed, but then you can't debug with Visual Studio anymore.
    So this is not really a propper solution to the problem, if you use the debugger.
    Restarting Unity doesn't fix the issue for me. It keeps coming back.
    I didn't have this issue with previous versions, so I guess there is some regression that reintroduced the issue after all the years.

    I hope someone at Unity does take a look.
     
  28. levwsr

    levwsr

    Joined:
    Jul 23, 2012
    Posts:
    68
    Try popping up the VS installer(s) and then go to Modify and uncheck unity integration. Reboot. Now go to the most current VS (im using 2019 community) and check unity to have in reinstall. Then launch unity and reattach, and try debugging. Worked for me.
     
    stefan_furcht likes this.
  29. stefan_furcht

    stefan_furcht

    Joined:
    Feb 10, 2017
    Posts:
    10
    I'll try. Thanks!
     
  30. MissileMax

    MissileMax

    Joined:
    Aug 20, 2018
    Posts:
    1
    I fixed it by running around my building. When I came back to my desk it was fixed.
     
  31. pcbeard

    pcbeard

    Joined:
    Jan 2, 2019
    Posts:
    4
    Simply updating to latest 2019 community version (16.4.1) and rebooting finally cleared this up for me.
     
  32. Evans_Horst

    Evans_Horst

    Joined:
    Jul 17, 2019
    Posts:
    3
    Disabling "Editor Attaching" fixed it for me, and when I re-enabled "Editor Attaching" the error did not return.
     
  33. donkey0t

    donkey0t

    Joined:
    Oct 23, 2016
    Posts:
    71
    Argh! Lame! Frustrating! v2019.2.21f1
    SocketException: An attempt was made to access a socket in a way forbidden by its access permissions.

    Happens when I first open a project, tends to fix itself if I just close and reopen again.
     
  34. SlimBun

    SlimBun

    Joined:
    May 24, 2019
    Posts:
    2
    Why is peoples still replying .-. he asked this on 2012 lol
     
  35. They show off that they're cool people and know what sockets are...
     
  36. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,197
    Unity 5.3... Good times.

    But it just shows that people are still having the same bugs from 4 years ago... which apparently is kinda normal, I still get notifications from threads of bugs from 6 years...
     
  37. k-bx

    k-bx

    Joined:
    Jun 23, 2020
    Posts:
    1
    Any fix?
     
  38. Molmez

    Molmez

    Joined:
    Feb 8, 2016
    Posts:
    7
    Unfortunately both Unity and VS share the curse of constantly releasing updates and never a genuinely stable version so update VS, reboot, and you're good to go. Until Unity releases another build for you to install as they do constantly. Most of your time developing games in Unity will be spent installing Unity versions, fixing Unity bugs, updating VS and rebooting lol

    Let's all face the music, learn C++ and make games properly :D
     
  39. mabakay

    mabakay

    Joined:
    Jun 10, 2016
    Posts:
    20
    Probably you have some VPN software which mess with network interfaces. Try to disable it and check again.
     
  40. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,448
    had the same recently, error went away after disabling vpn interface (then later enabling it back seems to work, no errors on startup)
    upload_2021-8-10_11-13-52.png
     
  41. zamesyne

    zamesyne

    Joined:
    Mar 17, 2019
    Posts:
    6
    I'm facing this issue in 2021.3.f1. Anything helps