Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSError: [WinError 10013] on Windows 10 #29

Open
ghost opened this issue Aug 2, 2021 · 1 comment
Open

OSError: [WinError 10013] on Windows 10 #29

ghost opened this issue Aug 2, 2021 · 1 comment

Comments

@ghost
Copy link

ghost commented Aug 2, 2021

Hello :)

Is it possible to fix this error somehow?

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text\Lib\python33\sublime_plugin.py", line 528, in on_api_ready
    plc()
  File "C:\Users\User\AppData\Roaming\Sublime Text\Installed Packages\RemoteSubl.sublime-package\remote_subl.py", line 331, in plugin_loaded
    server = TCPServer((host, port), ConnectionHandler)
  File "./python3.3/socketserver.py", line 430, in __init__
  File "./python3.3/socketserver.py", line 441, in server_bind
OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions

Thanks,
Ihor

@ScribblerCoder
Copy link

ScribblerCoder commented Feb 9, 2023

Hey, I faced the same issue today. Suddenly the plugin was no longer working and I couldn't edit any files over ssh. I started debugging:

TDLR: I hate windows

https://stackoverflow.com/questions/10461257/an-attempt-was-made-to-access-a-socket-in-a-way-forbidden-by-its-access-permissi

Long story short, run this in cmd as administrator

net stop hns
net start hns

Details:

I ran my usual ssh command but with -v option to check if the port forwarding was successful

.........SNIP.........
debug1: remote forward success for: listen 52698, connect 127.0.0.1:52698
debug1: All remote forwarding requests processed
.........SNIP.........

I checked that the server is listening on port 52698:

user@53rv3r:~$ sudo lsof -i TCP:52698
[sudo] password for silver:
COMMAND    PID   USER   FD   TYPE    DEVICE SIZE/OFF NODE NAME
sshd    655793 user   10u  IPv6 248089764      0t0  TCP ip6-localhost:52698 (LISTEN)
sshd    655793 user   11u  IPv4 248089765      0t0  TCP localhost:52698 (LISTEN)

then I checked if the client (Sublime Text) is listening on 52698 and it wasn't 😭

PS C:\Users\user> netstat -on | Select-String 52698  
PS C:\Users\user>

reinstalling ssh client/server on windows didn't help so I started debugging the plugin python script and ran the following simple code and it caused the same error mentioned in this issue

from threading import Thread
import socketserver

class ConnectionHandler(socketserver.BaseRequestHandler):           
    def handle(self):
        self.data = self.request.recv(1024).strip()
        print("{} wrote:".format(self.client_address[0]))
        r = ConnectionHandler(self.data, False)

class TCPServer(socketserver.ThreadingTCPServer):
    allow_reuse_address = True

server = TCPServer(("localhost", 52698), ConnectionHandler)
Thread(target=server.serve_forever, args=[]).start()

The issue was from Host Network Service from windows which didn't allow RemoteSubl to listen on 52698 (I hate windows)

Check out https://stackoverflow.com/questions/10461257/an-attempt-was-made-to-access-a-socket-in-a-way-forbidden-by-its-access-permissi

Run these commands on cmd as administrator and it should solve the issue

net stop hns
net start hns

@randy3k Maybe this workaround should be added in troubleshooting section

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant