First I want to thank you for a wonderful program.
The issue I am having is attempting to connect to a server behind a router with NAT at my work computer. Because of the NAT, the server has a local IP address and I don't have access to the router to do port forwarding.
It is easy to connect to this computer from home if someone is sitting at the remote computer and simply types "winvnc -connect MYHOMEIP". The problem is to automate this. I currently have it automated with a batch file which uses the NT task scheduler to execute a batch file containg the line "winvnc -connect MYHOMEIP" every minute. This works. I can connect to the office PC by just opening my home VNC client in listening mode and within 1 minute I will connect.
The problem is as follows. I need to manually stop the NT task scheduler from running the connect command every minute as soon as I log in, otherwise a new client window open up every minute! I then have to re-enable the task scheduler before logging out or I can never re-connect.
With this in mind, I suggest a simple option on the server to attempt to connect to a given IP address every x minutes. This eliminates the need to use a task scheduler porgram. In addition the server should not try to make a second connection to the same address when the 1st connection is still open (to prevent a new connection from being opened every minute). Is this difficult to implement?
I have programming experience but don't seem to be able to get a grasp on the source code for this project since it is so many different files, I don't know where to look, but I imagine that changes only needs to be made to a few lines of code to add this functinoality. If I can make any changes myself, please let me know.
Thanks,
Glenn
P.S. One other issue I'm having, even without specifying -autoreconnect in the commandline to the server, when I close one of these multiple client windows, it automatically re-opens. Why is this, and is there any way to stop it? Thanks again.
Update: UltraVNC 1.4.3.6 and UltraVNC SC 1.4.3.6: https://forum.uvnc.com/viewtopic.php?t=37885
Important: Please update to latest version before to create a reply, a topic or an issue: https://forum.uvnc.com/viewtopic.php?t=37864
Join us on social networks and share our announcements:
- Website: https://uvnc.com/
- GitHub: https://github.com/ultravnc
- Mastodon: https://mastodon.social/@ultravnc
- Facebook: https://www.facebook.com/ultravnc1
- X/Twitter: https://x.com/ultravnc1
- Reddit community: https://www.reddit.com/r/ultravnc
- OpenHub: https://openhub.net/p/ultravnc
Important: Please update to latest version before to create a reply, a topic or an issue: https://forum.uvnc.com/viewtopic.php?t=37864
Join us on social networks and share our announcements:
- Website: https://uvnc.com/
- GitHub: https://github.com/ultravnc
- Mastodon: https://mastodon.social/@ultravnc
- Facebook: https://www.facebook.com/ultravnc1
- X/Twitter: https://x.com/ultravnc1
- Reddit community: https://www.reddit.com/r/ultravnc
- OpenHub: https://openhub.net/p/ultravnc
Server Autoconnect
Server Autoconnect
This is another attractive alternative to the "broker server" or "bounce server" idea.
If "connect to client" could be set to retry every (n) minutes, with a "reconnect after lost connection" feature, this would solve my own NAT/firewall issue. We should be able to connect via VPN and then just use VNC as though you were inside the firewall, but the VPN is poorly managed and I'm not winning that argument.
But I'm still expected to get stuff done anyway.
This feature gets my vote.
If "connect to client" could be set to retry every (n) minutes, with a "reconnect after lost connection" feature, this would solve my own NAT/firewall issue. We should be able to connect via VPN and then just use VNC as though you were inside the firewall, but the VPN is poorly managed and I'm not winning that argument.
But I'm still expected to get stuff done anyway.
This feature gets my vote.
-
- Posts: 5
- Joined: 2004-12-07 21:16
my vote too
I'm working with a wireless network and it likes to drop sometimes, like when the boundry of service is being approached. The functionality to reconnect or to have the server keep trying to reconnect until it's back in the loop would be very helpful.
Thank you.
Thank you.
-
- 8
- Posts: 10
- Joined: 2004-12-14 02:30
Listen server connection initiated from remote
This is an intruiging question. I have been pondering possible solutions for a little while, and I've come to an idea. There are some points I would like to voice first though.
I don't think it's a good idea to have it attempt to just connect every minute. You LAN admin might not want the extra traffic, and every minute is kind of disheartening anyway. Also, if you should decide to have more than one incoming connection, this very quickly becomes an undesirable method. But, this simply depends on who you're dealing with and is likely a moot point anyway.
That being said, I believe the real issue here is not how to stop the VNC server from continuing to initiate a listen connection after it is successful, but rather, how to get the serving system to initiate the connection upon request from outside the network. I have a couple of thoughts on this...
** Thought number 1
The timing method is still a good idea, but we might consider basing the attempt to connect on something else. For example, the existance of a web page. What I mean is, if your home computer were running a web server program (lots of free ones available) you could place a web page titled "vncrequest.html" on your web server. The contents of that file are unimportant, because you would simply have your work computer's batch file use something like "WGET" (a command-line utility for downloading a web page) attempt to get that page from your home system, and check WGET's return-code value. If the page is present on your home system and was available, your batch initiates the VNC connection. Once the connection arrives, you simply rename the page on your home system and the work system will no longer attempt to connect as the "trigger" page is no longer where it was. You just rename it back to "vncrequest.html" and work attempts a new connection. It's a little bit round-about, but I think it's a little cleaner.
** Thought number 2
What about using some other free messenger service or program to initiate the connection. For example, if your work computer were running say... ICQ or MSN Messenger or something similar, you could have your work computer watch for a conversation to begin with your home computer. What I mean is, at home you say "hello" to your work computer's messenger program. Your work computer monitors running tasks and looks for one with the appropriate window title like "HomeSystem conversation" or whatever the messenger window calls the conversation dialog. Upon finding that conversation, you initiate the VNC server and close your conversation. This method could work with any kind of message system as long as the window name (or some other detection method) can be read with a batch or query. I used to use a program called ENUM or PS to query task names and launch programs based on what was running.
** Thought number 3 (I think I prefer this one)
You could also use command line FTP batch script to do whatever you want by sending a batch script as desired. You would connect to your home system's FTP server (also lots of free ones available, but I really like FileZilla FTP Server) and use a little-known command-line option "-s:filename" which instructs command-line FTP (windows) to begin running "filename" as a script set. You could have a batch file on your home system that you create when you wish it, and put in what ever batch commands you want the work system to run. You have the work system task scheduler set to periodically connect to your home FTP server and download a file "MyTask.bat" and when your work system downloads it, it calls it. You can obviously have any commands in the batch you want, VNC or otherwise.
I have used the FTP batch scripting to do some automated tasks. For example, for people that have a dynamic IP address, you use WGET to download your router's status page (which contains your WAN ip address) then you use FTP -s:filename to run a script to upload that file to your ISP's FTP server for your website. This way, you now have a file on the ISP showing your router's IP address. It's not as nice as a dynamic IP providor, but it's easy and clean and works.
Anyway, those are my thoughts. I hope it was useful to you.
Cheers
I don't think it's a good idea to have it attempt to just connect every minute. You LAN admin might not want the extra traffic, and every minute is kind of disheartening anyway. Also, if you should decide to have more than one incoming connection, this very quickly becomes an undesirable method. But, this simply depends on who you're dealing with and is likely a moot point anyway.
That being said, I believe the real issue here is not how to stop the VNC server from continuing to initiate a listen connection after it is successful, but rather, how to get the serving system to initiate the connection upon request from outside the network. I have a couple of thoughts on this...
** Thought number 1
The timing method is still a good idea, but we might consider basing the attempt to connect on something else. For example, the existance of a web page. What I mean is, if your home computer were running a web server program (lots of free ones available) you could place a web page titled "vncrequest.html" on your web server. The contents of that file are unimportant, because you would simply have your work computer's batch file use something like "WGET" (a command-line utility for downloading a web page) attempt to get that page from your home system, and check WGET's return-code value. If the page is present on your home system and was available, your batch initiates the VNC connection. Once the connection arrives, you simply rename the page on your home system and the work system will no longer attempt to connect as the "trigger" page is no longer where it was. You just rename it back to "vncrequest.html" and work attempts a new connection. It's a little bit round-about, but I think it's a little cleaner.
** Thought number 2
What about using some other free messenger service or program to initiate the connection. For example, if your work computer were running say... ICQ or MSN Messenger or something similar, you could have your work computer watch for a conversation to begin with your home computer. What I mean is, at home you say "hello" to your work computer's messenger program. Your work computer monitors running tasks and looks for one with the appropriate window title like "HomeSystem conversation" or whatever the messenger window calls the conversation dialog. Upon finding that conversation, you initiate the VNC server and close your conversation. This method could work with any kind of message system as long as the window name (or some other detection method) can be read with a batch or query. I used to use a program called ENUM or PS to query task names and launch programs based on what was running.
** Thought number 3 (I think I prefer this one)
You could also use command line FTP batch script to do whatever you want by sending a batch script as desired. You would connect to your home system's FTP server (also lots of free ones available, but I really like FileZilla FTP Server) and use a little-known command-line option "-s:filename" which instructs command-line FTP (windows) to begin running "filename" as a script set. You could have a batch file on your home system that you create when you wish it, and put in what ever batch commands you want the work system to run. You have the work system task scheduler set to periodically connect to your home FTP server and download a file "MyTask.bat" and when your work system downloads it, it calls it. You can obviously have any commands in the batch you want, VNC or otherwise.
I have used the FTP batch scripting to do some automated tasks. For example, for people that have a dynamic IP address, you use WGET to download your router's status page (which contains your WAN ip address) then you use FTP -s:filename to run a script to upload that file to your ISP's FTP server for your website. This way, you now have a file on the ISP showing your router's IP address. It's not as nice as a dynamic IP providor, but it's easy and clean and works.
Anyway, those are my thoughts. I hope it was useful to you.
Cheers
I may have a primitive solution
Oh, really thanks for your suggestion. I do agree that using a reachable web/ftp server as a channel for server to determine whether initiating a connection is good.
Since I have to use reverse connection in different machines and I have no admin. right of them(as well as network policies). All of machines are protected by the firewall from both network gateways and local machine (WinXP SP2). For me, I just want a very quick solution that can work in one or two days on a machine then I would switch to the others.
I have written a tiny JAVA tunneling program which is originally created by its author for port forwarding. This tunneling program is simple (several hundred lines of codes if you excluding the comments and the credits).
Here is how this command-line JAVA program works:
(0) user specify the listening port, forwarding ip and port (these three parameters are used in the same way as port forwarding )
and number of pipes ( I would describe in later)
(1) the program starting to listen a port specified by user.
(2) once a connection is accepted by the port, it initates a connection to the specified forwarding ip and port. It pretty like the port forwarding mechanism.
(2a) once accept the connection, the current available number of pipe is subtracted by 1. Listening port would only accept a connection if there is at least 1 number of pipe.
(2b) If there is no available pipe, the listening port would reject the connection. It does not affect any working connection.
(3) any disconnection from either side would terminate the connection in both side, and number of pipe is added by one in this case.
That's all. Set the initial number of pipe to one, then the first incoming VNC session will dominate the pipes and other forth- coming seesion would be rejected. Here is an example on how to use it:
java Porter 0.0.0.0 443 127.0.0.1 6000 1
Description:
Porter : java class name
0.0.0.0 : accept any connection from any machines, of course, for security reason, it could be set to the machine that would initiate a reverse VNC connection.
127.0.0.1 : forward the incoming connection to localhost
6000 : the VNC viewer listening port
1 : number of pipe, set to 1 if you only need one VNC session(that's what we want!)
Finally, set your VNCViewer to listen port 6000, then all is done.
Currently this program has a bug, the number of pipe would rarely run to zero even though there is no connection.
You could expect a bit performance drop because of JVM, but I think it is acceptable, if you need it, I could send you the program. Of course, you need JRE to run it.
Since I have to use reverse connection in different machines and I have no admin. right of them(as well as network policies). All of machines are protected by the firewall from both network gateways and local machine (WinXP SP2). For me, I just want a very quick solution that can work in one or two days on a machine then I would switch to the others.
I have written a tiny JAVA tunneling program which is originally created by its author for port forwarding. This tunneling program is simple (several hundred lines of codes if you excluding the comments and the credits).
Here is how this command-line JAVA program works:
(0) user specify the listening port, forwarding ip and port (these three parameters are used in the same way as port forwarding )
and number of pipes ( I would describe in later)
(1) the program starting to listen a port specified by user.
(2) once a connection is accepted by the port, it initates a connection to the specified forwarding ip and port. It pretty like the port forwarding mechanism.
(2a) once accept the connection, the current available number of pipe is subtracted by 1. Listening port would only accept a connection if there is at least 1 number of pipe.
(2b) If there is no available pipe, the listening port would reject the connection. It does not affect any working connection.
(3) any disconnection from either side would terminate the connection in both side, and number of pipe is added by one in this case.
That's all. Set the initial number of pipe to one, then the first incoming VNC session will dominate the pipes and other forth- coming seesion would be rejected. Here is an example on how to use it:
java Porter 0.0.0.0 443 127.0.0.1 6000 1
Description:
Porter : java class name
0.0.0.0 : accept any connection from any machines, of course, for security reason, it could be set to the machine that would initiate a reverse VNC connection.
127.0.0.1 : forward the incoming connection to localhost
6000 : the VNC viewer listening port
1 : number of pipe, set to 1 if you only need one VNC session(that's what we want!)
Finally, set your VNCViewer to listen port 6000, then all is done.
Currently this program has a bug, the number of pipe would rarely run to zero even though there is no connection.
You could expect a bit performance drop because of JVM, but I think it is acceptable, if you need it, I could send you the program. Of course, you need JRE to run it.