setting vncviewer to listen on specific port?

Habermann, David (DA) habermann "at" dow.com
Fri, 09 Jun 2000 13:27:42 +0000


"Jason R. Coombs" <jaraco "at" nmt.edu> wrote:
> 
> It's pretty well documented how to set WinVNC to listen on a specific port
> and to connect with the viewer in that configuration.
> 
> I've got a machine behind a firewall that I'd like to connect to, so I'd
> like it to be able to connect to a client outside the firewall.  I can only
> use port 23 or 80.
> 
> I can set the port in WinVNC.  How do I set it for the listening vncviewer?

In the standard distribution from AT&T the listening port for the VNCVIEWER may not be altered.  It is hard-coded to 5500.  Included below is a couple of small hacks to the source code I made to do exactly what you want.  After these are done, vncviewer can be started with the following command line to start listening on port 80:

vncviewer -listen 80

If you'd rather have the executable, contact me privately and I'll be happy to send it (no warrantees either expressed or implied either from my company or me personally).  This list no longer can accept attachments.

I wonder if our friendly VNC developers would consider adding this very modest improvement to their next release?

Dave Habermann

-----------------------------------------------------------------------------

The purpose of these hacks are to allow the port on which VNCViewer listens 
to be user-specified.  This hacks were applied to the VNC 3.3.3r6 original 
distribution on May 19, 2000 (note: should be the same on r7)

1)	Made change to VNCOptions.h

	bool	m_listening;
	int		m_listening_port; // DAH hack to allow setting port number at startup
	bool	m_connectionSpecified;

2)	Made change to VNCOptions.ccp

		} else if ( SwitchMatch(args[j], _T("listen"))) {
			m_listening = true;
			// Begin DAH hack to allow setting listening port at startup
			m_listening_port = INCOMING_PORT_OFFSET;
			int local_port_value;
			if ((j+1) < i)
			{
				int result = sscanf(args[j+1], "%d", &local_port_value);
				if (!(result == 0) && !(result == EOF))
				{
					m_listening_port = local_port_value;
					j = j + 1; // skip the next parameter
				}
			}
			// End DAH hack to allow settting listening port at startup
		} else if ( SwitchMatch(args[j], _T("restricted"))) {

3)	Made change to VNCviewerApp32.ccp

			m_pflasher = new Flasher(FLASH_PORT_OFFSET);
			m_pdaemon = new Daemon(m_options.m_listening_port); // DAH hack to set port number
			// m_pdaemon = new Daemon(INCOMING_PORT_OFFSET); DAH hack original code

4)  Set the active configuration to "VncViewer - Win32 Release

5)  Compile program (used "rebuild all", VC++ v6.0), no errors are noted

6)  Substitute vncviewer.exe for the original one located in c:\program files\orl\vnc
---------------------------------------------------------------------
To unsubscribe, send a message with the line: unsubscribe vnc-list
to majordomo "at" uk.research.att.com
See also: http://www.uk.research.att.com/vnc/intouch.html
---------------------------------------------------------------------