randy3k / RemoteSubl

Use rmate with Sublime Text, an improved fork of rsub.
327 stars 20 forks source link

2 users using subl at the same time #11

Open botmike opened 4 years ago

botmike commented 4 years ago

If I have 2 users, one logged tunneled on computerA as: ssh -R 52698:localhost:52698 usera@192.168.1.206

Another tunneld on computerB as: ssh -R 52699:localhost:52699 userb@192.168.1.206

using subl myfile.txt

opens it only on the 1st persons computerA (no matter which user when do it with)

So, can we tunnel with different ports for different users instead of just 52698 (so that different people can edit with sublime on different machines, or are we restricted to only one person using this at a time) ?

randy3k commented 4 years ago

you could forward a different remote port to the local machine 52698.

To connect to a different port via the rmate client, you could either set the env variable RMATE_PORT or pass the argument -p <number> to rmate.

botmike commented 4 years ago

So while someone (user1) was using this on another machine, eg: ssh -R 52699:localhost:52699 user1@192.168.1.206

I tried: ssh -R 52696:localhost:52696 user2@192.168.1.206

then: rsubl myfile -p 52696

and got: setsockopt TCP_NODELAY: Invalid argument connect_to localhost port 52696: failed.

I dont think I am doing this right, I'm not even sure what I should be doing, if we are both on the same IP, how will it know to open sublime on one computer (if using one port) and then open sublime on another computer if using another port.

Has anyone had experience of using this plugin with 2 different users on the same network? can it be done?

(I tried using rsubl myfile -p 52698, but that opened up on my friends sublime, because he had the tunnel opened 1st, I dont know how this can work with 2 users on the same network)

botmike commented 4 years ago

figured it out(I was being dumb), both users have to use port numbers, like:

ssh -R 52679:localhost:52696 user2@192.168.1.206 rsubl -p 52679 myfile2

and

ssh -R 52678:localhost:52696 user2@192.168.1.206 rsubl -p 52678 myfile1

solution was mentioned here: https://acarril.github.io/posts/ssh-sripts-st3