Sponsored Content
Top Forums Programming How to pass FIFO path to client process ? Post 302196374 by Ametis1970 on Sunday 18th of May 2008 04:30:05 AM
Old 05-18-2008
How to pass FIFO path to client process ?

Hello everybody !

I have a first program, called "server" which build 2 FIFO's in this way:
Code:
...
#define PERMS 0666
#define FIFO1 "\tmp\cerere"
#define FIFO2 "\tmp\raspuns"
...
mkfifo(FIFO1, PERMS)
mkfifo(FIFO2, PERMS)
...

I want to access these FIFO's in a second separate program, called "client".
I tried to pass the FIFO's path in the client command line, like that:
Quote:
./client \tmp\cerere \tmp\raspuns
but when I tried to open the FIFO's the results were only "Error: No such file or directory."

This is how I transform the command line arguments in "client":
Code:
...
const char* FIFO1 = malloc(sizeof (argv[1]));
strncpy(FIFO1, argv[1], strlen(argv[1]));
const char* FIFO2 = malloc(sizeof (argv[2]));
strncpy(FIFO2, argv[2], strlen(argv[2]));
...

I tried another ways to pass the FIFO's path in the client command line, like that:
Quote:
./client /tmp/cerere /tmp/raspuns
Quote:
./client '\tmp\cerere' '\tmp\raspuns'
Quote:
./client '/tmp/cerere' '/tmp/raspuns'
Quote:
./client "\tmp\cerere" "\tmp\raspuns"
Quote:
./client "/tmp/cerere" "/tmp/raspuns"
I received same error.

If I defined directly the FIFO's path in the source code of "client", like that:
Code:
#define FIFO1 "\tmp\cerere"
#define FIFO2 "\tmp\raspuns"

the "client" works fine.

What is wrong ? May somebody help me ?
Thank you !
 

10 More Discussions You Might Find Interesting

1. Programming

i want to pass the connect fd to child process,how can i do ti?

i write a function using to pass the socket connected fd to child process in the sco unix open server 5.0.5,but in fact i execute the program calling the fuction,system report send the fd error: Jul 12 12:15 send_fd.c: send_fd sendmsg to sd error how can i solve the problem ,please help me!!!... (6 Replies)
Discussion started by: hit
6 Replies

2. UNIX Desktop Questions & Answers

Does it require each x-client sould run in separate process?

Hi Every One, I got a Basic doubts about clients on X-Server environment. 1) First of all what is mend by one client. (as per my understanding one application which is connected to X-server). 2) if i say two clients connected to my X-Server from the same machine, does it mean that two... (0 Replies)
Discussion started by: ps_sureshreddi
0 Replies

3. Programming

Client server communication using FIFO.

Hiii..... I need a client server communication using a FIFO. Sever is contacted by multiple clients.Each client writes its request to a FIFO.The server replies back to the client through a client specific FIFO. give any link to sample FIFO programs.......... Thanking you KRISH:cool: (1 Reply)
Discussion started by: krishnampkkm
1 Replies

4. Shell Programming and Scripting

How to pass data from server (CGI script) to client (html page)

Hi I know how to pass data from client side (html file) to server using CGI script (POST method). I also know how to re-create the html page from server side after receiving the data (using printf). However I want to write static pages on client side (only the structure), and only to pass... (0 Replies)
Discussion started by: naamabm
0 Replies

5. AIX

tprof, truncate the process path

Hi, i tryed tprof -skex sleep 6 but... Process PID TID Total Kernel User Shared Other Java ======= === === ===== ====== ==== ====== ===== ==== wait 57372 77863 31.31 31.31 0.00 0.00 0.00 0.00 wait ... (1 Reply)
Discussion started by: zanac
1 Replies

6. UNIX for Dummies Questions & Answers

Calling a webservice and pass a client certificate

Hi, I am trying to call a http soap webservice using curl command , I have tried the below option but I am getting a failure . curl -H "Content-Type: text/xml; charset=utf-8" -H SOAPAction:" -d @Request.xml -X POST... (1 Reply)
Discussion started by: IshuGupta
1 Replies

7. Shell Programming and Scripting

Pass return value of a function in background process

Hi, I have created a function f1 defined in script A.sh .I have called this function in background . But I want to use its return value for another function f2 in script A.sh. I tried declaring it as a global variable, yet it always returns the status as 0. Is there any way with which I can get... (7 Replies)
Discussion started by: ashima jain
7 Replies

8. Shell Programming and Scripting

Pass File name and Directory Path through command to python script

I'm writing python script to get the file-names in the current directory and file sizes .I'm able to get file list and their sizes but unable to pass them through command line. I want to use this script to execute on other directory and pass directory path with file name through command line. Any... (1 Reply)
Discussion started by: etldeveloper
1 Replies

9. Shell Programming and Scripting

Pass path variable on SSH

hi Gurus, Have been struggling with this for a while I have 2 servers , lets say local A and remote B, I need to use both as a part of a pipeline. The folder structure is shared between the two, so I can access the same files and folders from both A and B. When I try to ssh into B from A,... (15 Replies)
Discussion started by: senhia83
15 Replies

10. UNIX for Beginners Questions & Answers

By pass a process in a Shell Script on file size

I wish to by pass a process if the file is over a certain size? not sure this makes sense current bit of the script below #if we are bypAssing the OCR if ; then echo Bypassing HOTFOLDER OCR HOT_FOLDER_DIR=$BATCH_POST_OCR_DIR; potential change below? would this work would I need... (1 Reply)
Discussion started by: worky
1 Replies
MKFIFO(3)						     Linux Programmer's Manual							 MKFIFO(3)

NAME
mkfifo - make a FIFO special file (a named pipe) SYNOPSIS
#include <sys/types.h> #include <sys/stat.h> int mkfifo(const char *pathname, mode_t mode); DESCRIPTION
mkfifo makes a FIFO special file with name pathname. mode specifies the FIFO's permissions. It is modified by the process's umask in the usual way: the permissions of the created file are (mode & ~umask). A FIFO special file is similar to a pipe, except that it is created in a different way. Instead of being an anonymous communications chan- nel, a FIFO special file is entered into the file system by calling mkfifo. Once you have created a FIFO special file in this way, any process can open it for reading or writing, in the same way as an ordinary file. However, it has to be open at both ends simultaneously before you can proceed to do any input or output operations on it. Opening a FIFO for reading normally blocks until some other process opens the same FIFO for writing, and vice versa. See fifo(4) for non-blocking handling of FIFO special files. RETURN VALUE
The normal, successful return value from mkfifo is 0. In the case of an error, -1 is returned (in which case, errno is set appropriately). ERRORS
EACCES One of the directories in pathname did not allow search (execute) permission. EEXIST pathname already exists. ENAMETOOLONG Either the total length of pathname is greater than PATH_MAX, or an individual file name component has a length greater than NAME_MAX. In the GNU system, there is no imposed limit on overall file name length, but some file systems may place limits on the length of a component. ENOENT A directory component in pathname does not exist or is a dangling symbolic link. ENOSPC The directory or filesystem has no room for the new file. ENOTDIR A component used as a directory in pathname is not, in fact, a directory. EROFS pathname refers to a read-only filesystem. CONFORMING TO
POSIX.1 SEE ALSO
mkfifo(1), read(2), write(2), open(2), close(2), stat(2), umask(2), fifo(4) Linux 1.2.13 1995-09-03 MKFIFO(3)
All times are GMT -4. The time now is 08:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy