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 ...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
|||
|
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!! |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| 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 |