Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When I start a new X server using vncserver I can connect it using port 5901. From, say, a terminal, I can also do a:

export DISPLAY=:1.0 xterm

(it's just an example)

And I get an xterm on the Xvncserver.

What is the relation between :1.0 and port 5901?

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

Port 5901, generally by convention Port 5900 + XDisplaynumber, is the TCP Port on which the VNC service listens. That's their relation. Actually you may use arbitrary TCP Ports with arbitrary Xdisplaynumbers.

The VNC service is meant to transports input (mouse, keyboard) from the client to the server and output (an image) from the server to the client. This does not need to have anything to with X. For example in virtualization VNC is often used to make the "physical" terminal of a virtual machine remotely accessible.

The X11 System is much more complex than that and programs use it to interact with the Xserver and with each other. In wording in the X world is a little unintuitive at first so the meaning of output, seat, screen, display, server, client need to be learned and deserve some consideration.

To your question: an Xdisplay is the logical core of any X instance. When you start a program that program is a Xclient and connects to the provided display of an Xserver. :1.0 is actually an abreviation and means "display 1 at localhost". You can provide a hostname or IP-address e.g. DISPLAY=192.168.1.2:3.0 to have the program you are about start connect to Xdisplay 3 at the (remote) computer with the given IP-address.

X and VNC are two totally different services implemented for different purposes with different goals. (One may argue that some/most VNC goals were also goals when developing X, but that's rather academic and very in depth.)

When using Xvncserver both concepts are combined back to back. So there is an Xserver with which Xclients communicate "the normal way" but instead of using the hardware available to interact with a user, the Xvncserverit implements a VNC server, to which a VNC client can connect.

share|improve this answer
add comment

Inherently, none.

When you run the xvncserver it needs to do two things.

  1. Open a listening port (which for VNC is 5901
  2. Create a display target

The display target can be any number. Commonly, logging in on the console via X will use display :0. It doesn't have to, you could log in on the console first and then use startx :36 instead. VNC uses 1.0 by default because it's probably the first available display.

These two are chosen by convention, there's no magic that binds them together except the running process attached to both.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.