Daring to challenge the will of the almighty Leviam00se, Casper H.S. Dik -
: [[ PLEASE DON'T SEND ME EMAIL COPIES OF POSTINGS ]]
: >Hi,experts of solaris
: >Could anybody tell me how to change Solaris 2.5.1's openwindows's tcp port
: >number? I have a set of application used tcp port 6000, and I found it was
: >occupied by openwin's X server. If you can solve this problem, please let
: >me know. Thanks a lot
: You can't.
Well... that's not strictly true. That is, you can't just edit a config
file somewhere and magically have the X server use a different port, but
you can make it use a different number.
The port number depends somewhat on the display number. That is, when
you start the X server on a single-head display, that server instance
becomes display :0 and clients can contact it at port 6000. But if the
display is instead set as :1, then it will use port 6001. If it's :2
then it will use 6002, and so on. (If the X server supports combining
multiple frame buffers into a single display, then you may have the
same display number with multiple screes, i.e. :0.0, :0.1, :0.2, etc.)
If you are using openwin without CDE (meaning that you log in on the
console and start openwin manually) then you can create a .xserverrc
file in your home directory and place in it the flags to pass to the
X server when it starts, including the display number. If you use :1
instead of :0, then the server will use port 6001. If you are using
CDE, then you'll either have to use 'Command line login' to get into
the system and start openwin manually or edit /usr/dt/config/Xservers
so that it uses :1 instead of :0 and restart dtlogin.
The downside to doing this is that if you have an X11 application
somewhere that is set to always use display :0, you may have to tweak
it to use the new display value.
: And picking port 6000 for your application isn't a good idea.
: All X servers use port 6000, putting somethign else tehre will give
: unexpected results.
Agreed: selecting port 6000 is a bad idea. If you wrote the program,
then I suggest changing it to use a different port. Better still,
change it to use getservbyname() so that you can register the port
number in your /etc/services file (or services NIS/NIS+ database).
That way you can change the port just by updating the services database
and the application will pick up the change automatically.
-Bill Paul (212) 854-6020 | System Manager, Master of Unix-Fu
"Now, that's "Open" as used in the sentence "Open your wallet", right?"