nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

Xlib: connection to ":0.0" refused by server and Xlib: No protocol specified

This is a discussion on Xlib: connection to ":0.0" refused by server and Xlib: No protocol specified within the Linux software forums, part of the Linux Getting Started category; hi everybody, i have problem regarding KDE environment. i want to open gedit/kwrite application through program from one linux machine ...


Go Back   nixCraft Linux Forum > Linux Getting Started > Linux software

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 03-07-2008, 11:16 AM
Junior Member
User
 
Join Date: Mar 2008
My distro: FEDRORA
Posts: 1
Rep Power: 0
rajnivanza is on a distinguished road
Default Xlib: connection to ":0.0" refused by server and Xlib: No protocol specified

hi everybody,

i have problem regarding KDE environment.
i want to open gedit/kwrite application through program from one linux machine to another linux machine.
its work well when login user as "root" but when login user as "normal user" then display error.

I have written given below code:

cCommand = "gedit" / "kwrite"
uname = "/root" / "/home/rajni"

int executeCommand( char *cCommand )
{
char *uname = malloc (sizeof(char) * UNAME_MAX);
if(homeDir(uname) == FAILURE) {
free( uname );
setError( FNAME, "[Error] : homeDir() failed\n" );
return FAILURE;
}

pid_t pid=fork(); //don't know how vfork and environ works together.
if(pid==-1)
{
setError(FNAME,"fork failed. executeCommand()\n");
return FAILURE;
}
else if(pid == 0) //child
{
setenv("HOME",uname,1); //proper solutions pending. see ~/.Xauthority, xauth etc.
setenv("DISPLAY",":0.0",1);
free( uname );
exit(system(cCommand)); //beware of: return(system(cCommand));
}
else //parent
{
sleep(1); //let the child run first
int status;
if (waitpid (pid, &status, WNOHANG) == pid)
{
if (WIFEXITED (statu && WEXITSTATUS (statu == 32512) //system() returns this on
//system(unexistsing_bin);
{
char msg[100];
sprintf(msg,"unable to execute %s. executeComamnd()\n",cCommand);
setError (FNAME,msg); //not working. debug it.
return FAILURE;
}
}
}
return SUCCESS;
}

we get right username path and display error as :
->Xlib: connection to ":0.0" refused by server
->Xlib: No protocol specified

and so,it can't execute the "gedit" / "kwrite" Xcommand successful.

Why is this happening, and how do I fix it?

I would be very grateful if I could receive your favorable reply.

Thanks!!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-08-2008, 02:44 PM
Junior Member
User
 
Join Date: Apr 2008
My distro: SL4
Posts: 1
Rep Power: 0
wahaj87 is on a distinguished road
Default How to run this ?

hi rajnivanza

how to run the code you given below.

newbie

wahaj
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Does Redhat have "what" utility which can be used to display identification Info? DCAO Linux software 2 10-30-2007 07:23 PM
[Commercial] SafeSquid "SPEED-BOOSTER" 4.2.0 Released httpproxy Networking, Firewalls and Security 1 09-26-2007 08:05 PM
Connection to "google.com" shilpigoel1 Getting started tutorials 1 07-05-2007 01:17 AM
Connection to "google.com" refused shilpigoel1 Getting started tutorials 3 07-03-2007 11:02 AM
connection to "google.com" is refused shilpigoel1 Networking, Firewalls and Security 0 06-29-2007 05:25 PM


All times are GMT +5.5. The time now is 05:27 AM.


Powered by vBulletin® Version 3.7.3 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36