the client reads a pathname from the standard input and writes it to pipe1.The server reads this pathname from the pipe1 and tries to open the file for reading.If the server can open the file ,the server responds by reading the file and writting it to pipe2;otherwise the server writes an error message to the same pipe.The client then reads from the pipe2 and writes it receives to the standard output
here is my code:
Actually ,I understand that there might be some problems with race conditions that's why i put 2 sleep commands but still doesn't work..
generally i want to sychronize the read and write commands of the client and server but I don't know how...
if someone has the time to see the code and give me some advice,it will really be appreciated.....thanks in advance..
Hi, yes i belong to that duummies group of people so here is the question that i need someone to explain it to me and posiblly to answere it to me in a plain english.
This is the question:
Describe the concept of “client-server” software. Discuss what each side
of the equation... (2 Replies)
Hi,
I have installed the vmware server on my debian os and has several clients connected to it. Is there any script that enable the server to restart the client automatically??
Can anyone help.
Thanks in advance (3 Replies)
Problem
- Linux Client/Server Socket Application: Preventing Client from quitting on server crash
Hi,
I am writing a Linux socket Server and Client using TCP protocol on Ubuntu 9.04 x64.
I am having problem trying to implement a scenario where the client should keep running even when the... (2 Replies)
Hi All,
I need your expertise in finding a way to solve my problem.Please excuse if this is not the right forum to ask this question and guide me to the correct forum,if possible.
I am a DBA and on a daily basis i have to ftp huge dump files from my company server to my laptop and then... (3 Replies)
I want to have a message send & receive through 2 half-duplex pipes
Flow of data
top half pipe
stdin--->parent(client) fd1--->pipe1-->child(server) fd1
bottom half pipe
child(server) fd2---->pipe2--->parent(client) fd2--->stdout
I need to have boundary structed message... (1 Reply)
Hello,
Please I would create a client and a server in C that communicate frequently. The client sends "hello message" to the server, the server waits a few minutes and sends a "hello message" to the client, the client sends again "hello server ".. etc up to 15 minutes
Can you guide me... (3 Replies)
Hello,
Please, is there on unix.com the source code of a client C and server C: as shown in following figure:
File:InternetSocketBasicDiagram zhtw.png - Wikipedia, the free encyclopedia
Thank you so much for help (1 Reply)
I'm writing a simple chat client in C++ on linux to connect to a win32 chat server on my computer also written in C++. I'm confident that the server works but the chat client is giving me some trouble. I'm forking the chat client and have one process dealing with incoming messages and another... (14 Replies)
hi, i am new to unix,
cuold u send some sftp acripts to send files to dev server to clint server, (1 Reply)
Discussion started by: Koti.annam
1 Replies
LEARN ABOUT NETBSD
pipe2
PIPE(2) BSD System Calls Manual PIPE(2)NAME
pipe -- create descriptor pair for interprocess communication
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <unistd.h>
int
pipe(int fildes[2]);
int
pipe2(int fildes[2], int flags);
DESCRIPTION
The pipe() function creates a pipe, which is an object allowing unidirectional data flow, and allocates a pair of file descriptors. The
first descriptor connects to the read end of the pipe, and the second connects to the write end, so that data written to fildes[1] appears on
(i.e., can be read from) fildes[0]. This allows the output of one program to be sent to another program: the source's standard output is set
up to be the write end of the pipe, and the sink's standard input is set up to be the read end of the pipe. The pipe itself persists until
all its associated descriptors are closed.
A pipe whose read or write end has been closed is considered widowed. Writing on such a pipe causes the writing process to receive a SIGPIPE
signal. Widowing a pipe is the only way to deliver end-of-file to a reader: after the reader consumes any buffered data, reading a widowed
pipe returns a zero count.
The pipe2() function behaves exactly like pipe() only it allows extra flags to be set on the returned file descriptor. The following flags
are valid:
O_CLOEXEC Set the ``close-on-exec'' property.
O_NONBLOCK Sets non-blocking I/O.
O_NOSIGPIPE
Return EPIPE instead of raising SIGPIPE.
RETURN VALUES
On successful creation of the pipe, zero is returned. Otherwise, a value of -1 is returned and the variable errno set to indicate the error.
ERRORS
The pipe() and pipe2() calls will fail if:
[EFAULT] The fildes buffer is in an invalid area of the process's address space. The reliable detection of this error cannot be
guaranteed; when not detected, a signal may be delivered to the process, indicating an address violation.
[EMFILE] Too many descriptors are active.
[ENFILE] The system file table is full.
pipe2() will also fail if:
[EINVAL] flags is other than O_NONBLOCK or O_CLOEXEC.
SEE ALSO sh(1), fork(2), read(2), socketpair(2), write(2)STANDARDS
The pipe() function conforms to ISO/IEC 9945-1:1990 (``POSIX.1'').
HISTORY
A pipe() function call appeared in Version 6 AT&T UNIX. The pipe2() function is inspired from Linux and appeared in NetBSD 6.0.
BSD January 23, 2012 BSD