Sponsored Content
Top Forums Programming please help a problem in client-server ipc message 2 pipes communication simple example Post 302529470 by Corona688 on Thursday 9th of June 2011 11:29:26 AM
Old 06-09-2011
You've got the parameters for client() wrong. You're giving it a readfd which is the write-end of the wrong pipe, and a writefd which is the read-end of the other wrong pipe. Try client(pipe2[0], pipe1[1]);

Also keep in mind that the message from the child only gets flushed because it quits. Pipes have a long buffer. If you try to wait for a message from the client when it hasn't quit, you could just block forever. (Leaving in the newlines might help.)
This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Interprocess communication using pipes and fork

I'm very worried. I have an assignment that is due in 3 weeks, and also tute exercises which I can't seem to understand and work out. Okay, the question: The parent process will convert the command arguments into integer values using atoi() and store them into an integer array which you will... (2 Replies)
Discussion started by: scmay
2 Replies

2. Cybersecurity

client-server message transfer

using fork().how do v send and receive messages in child and parent process. (2 Replies)
Discussion started by: krishnavel
2 Replies

3. UNIX for Dummies Questions & Answers

socket programming : client server IPC

I'm new to socket programming. Have a basic doubt. I have a structure(global) at the server side. I have two different client connecting to the server. Will the changes made by one client on the structure be visible to the other client when it accesses the same client? I'm creating a STREAM... (3 Replies)
Discussion started by: abc.working
3 Replies

4. UNIX for Advanced & Expert Users

Inter-process communication:pipes,doors,etc.

Hi, I am thinking about writing a log daemon for a multi-processed ksh application (yes - I know that high-level language would be a better option). My question is as follows: If many processes (many scripts) will try writing to a single log file: print "message" > common.log Will it work or... (2 Replies)
Discussion started by: adderek
2 Replies

5. Programming

client /server pipes

here is the concept: 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... (2 Replies)
Discussion started by: tolkki
2 Replies

6. Programming

C program using IPC (inter process communication)

i want to write a C chat program that communicates over IPC(inter process communication), that could be run using 2 seperate terminal windows within the same computer. so that wat u type in one terminal window , should appear on the other and vice versa... could some one please help me with the... (2 Replies)
Discussion started by: localp
2 Replies

7. 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

8. Programming

IPC between processes, pipes, etc

I need help with understanding this in C-programming style(the systemcalls only): Three processes communicates via two pipes. (when the processes creates all stdin is the keyboard and all stdout is the screen) This is how the communication goes: Process 2 stdin (keyboard) and stdout goes via... (3 Replies)
Discussion started by: oskis
3 Replies

9. Programming

IPC - pipes between parent and child process

Hi guys, I'm having some problem here, I'm studying pipes, and i want to create a shell in C and at this point a don't want to use semaphores, instead I want to use tricks. Straight to the doubt: I've a parent and a child process, and both of them has some code to execute, and the child process... (5 Replies)
Discussion started by: pharaoh
5 Replies

10. Programming

kill() function problem in client-server ipc message using 2 FIFOs

I want to have a message send & receive through 2 uni-direction FIFO Flow of data FIFO1 stdin--->parent(client) writefd--->FIFO1-->child(server) readfd FIFO2 child(server) writefd2---->FIFO2--->parent(client) readfd2--->stdout I need to have boundary structed message... (3 Replies)
Discussion started by: ouou
3 Replies
USB_CONTROL_MSG(9)						   USB Core APIs						USB_CONTROL_MSG(9)

NAME
usb_control_msg - Builds a control urb, sends it off and waits for completion SYNOPSIS
int usb_control_msg(struct usb_device * dev, unsigned int pipe, __u8 request, __u8 requesttype, __u16 value, __u16 index, void * data, __u16 size, int timeout); ARGUMENTS
dev pointer to the usb device to send the message to pipe endpoint "pipe" to send the message to request USB message request value requesttype USB message request type value value USB message value index USB message index value data pointer to the data to send size length in bytes of the data to send timeout time in msecs to wait for the message to complete before timing out (if 0 the wait is forever) CONTEXT
!in_interrupt () DESCRIPTION
This function sends a simple control message to a specified endpoint and waits for the message to complete, or timeout. If successful, it returns the number of bytes transferred, otherwise a negative error number. Don't use this function from within an interrupt context, like a bottom half handler. If you need an asynchronous message, or need to send a message from within interrupt context, use usb_submit_urb. If a thread in your driver uses this call, make sure your disconnect method can wait for it to complete. Since you don't have a handle on the URB used, you can't cancel the request. COPYRIGHT
Kernel Hackers Manual 2.6. July 2010 USB_CONTROL_MSG(9)
All times are GMT -4. The time now is 01:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy