I am using RHEL 6.0 and when i type the given command in terminal
telnet 127.0.0.1 6000
I am getting output as:
Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused
Why is this connection refusing?
Because there's nothing listening there. If you'd expect an X server to answer, you'll need to tell it to enable TCP (remove the
-nolisten tcp for instance, or add
-listen tcp for those that don't listen on TCP by default).
But if you don't need your X server to be accessed directly over the network (other than tunnelled/proxied over
ssh), it's probably wiser to leave it there.
You can connect to your X server with a Unix domain socket instead. For instance (for
socat - /tmp/.X11-unix/X0
Which would be the equivalent of:
socat - tcp:localhost:6000
Or (as you're on Linux), with an abstract domain socket:
socat - abstract:/tmp/.X11-unix/X0
Other reasons why you can't talk to your X server would be if it's listening on a different port (6000 is for the
:0 display) or not at that address or the wildcard address, or on a different network protocol (
IPv6 instead of
IPv4), or if there's a firewall rule rejecting connections there.