Praying for help: FIFOs, IPC


 
Thread Tools Search this Thread
Top Forums Programming Praying for help: FIFOs, IPC
# 1  
Old 05-17-2005
Error Praying for help: FIFOs, IPC

omg i need help so bad. I've been working on a school project for what seems like an eternity and i'm close to deadline. Using FIFO's (i ahve to) to communicate between parent and child proc's. Right now I'm stuck on a read/write.

fifomsg is a struct with int length and char[16] message fields. This is what I'm trying to send between the processes.

child code:
Code:
fdw = Open("syscallfifo", O_WRONLY);

	fifomsg msg1;        
	strcpy(msg1.message, (char*)pid);
	msg1.length = sizeof(msg1);

        write(fdw, &msg1, sizeof(msg1));
	close(fdw);

parent code:

Code:
fdr = Open("syscallfifo", O_RDWR);
	
	fifomsg msg1;
	
	read(fdr, &msg1.length, sizeof(msg1.length));
	read(fdr, &msg1.message, sizeof(msg1) - sizeof(msg1.length));
	close(fdr);


At this point in execution, the process halts and I have to suspend/kill. I'm begging for help. As soon as possible would be ideal.

Thank anyone for any consideration.

edit: wanted to mention I manaully browsed through the last 5 or 6 months of posts trying to find a similar situation and couldn't.
# 2  
Old 05-18-2005
Moderators, are we allowed to help here?
# 3  
Old 05-18-2005
I'll look the other way if you want to give some advice. Smilie
# 4  
Old 05-18-2005
i don't get it. what did i do?
# 5  
Old 05-18-2005
I guess you missed:
(6) Do not post classroom or homework problems.
when you read our rules. Smilie
# 6  
Old 05-18-2005
well, you're right, sorry I missed it.
forget it then.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

help with IPC + thread

Actually i am thinking of some usefull application that involves both IPC and pthreads.But i am not quite sure what type of application involves both these together :confused:. Anyways i am now working on creating a simple featured file manager that can do the following: Display file name and... (2 Replies)
Discussion started by: ronmaximus
2 Replies

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

3. Solaris

errors on Netra-440: "IPC Warning: ipc: tcp_protocol: bad magic number"

I was asked to look into a problem with a Sun Netra 440 in another department. On the server in question, the relevant 'uname -a' information is, "SunOS host1 5.9 Generic_118558-16 sun4u sparc SUNW,Netra-440". That information aside, while the other admin is logged into the ALOM, these errors are... (0 Replies)
Discussion started by: Borealis
0 Replies

4. Programming

IPC with PIPE

Hi guys, I'm new to Linux and Unix I have just simple code . But I don't know why it doesn't work .. But, the outputfile is Blank.. I don't understand why.. Please help me.. Thank you very much P.S: sorry, I don't know how to edit this post clearly.. it's hard to read.. Please try.. (2 Replies)
Discussion started by: thanh_sam_khac
2 Replies

5. Programming

[C] Problem with IPC

Hi! I'm trying to write this program: in my intentions it should get a message and send it to a second process (pid_upost), then to a third process (pid1, pid2, pid3, depending on the choice made when a new message is inserted). This program should write the message in a file (message1, message2 or... (1 Reply)
Discussion started by: Kaminski
1 Replies

6. UNIX for Advanced & Expert Users

UNIX domain sockets vs FIFOs

Is there a performance advantage of one of these over the other? Obviously, it makes no sense to use normal TCP sockets or UDP sockets w/ the overhead they carry. But what about UNIX domain sockets vs FIFOs? I'd think they'd be very similar, in terms of performance and in terms of how they're... (2 Replies)
Discussion started by: mgessner
2 Replies

7. UNIX for Advanced & Expert Users

tar and fifos

How can I make tar read data from a fifo, instead of storing it as a fifo? (8 Replies)
Discussion started by: Corona688
8 Replies

8. Linux

A little help understanding FIFOs?

This isn't strictly a Linux question, but... I've been working on a project to archive some streaming media for time shifting using 'mplayer' and have been using FIFOs to archive in Ogg Vorbis format: mkfifo program_name.wav (mplayer -ao pcm -aofile program_name.wav &)... (0 Replies)
Discussion started by: deckard
0 Replies

9. Programming

forks, ipc, fifos, update issues...

Hi, so I've got this program("main") that fork executes another ("user"). These programs communicate through fifos. One communication is a spawn call, where user passes an executable, main forks and executes it. So, I'm keeping track of all my processes using a task table. After the fork (for... (6 Replies)
Discussion started by: Funktar
6 Replies

10. UNIX for Dummies Questions & Answers

Ipc

I have a parent that is passing data to child A and then child A has to process it and pass to child B. I am able to pass the data to child A but am not able to pass it to child B. Child B seems to only be receiving the last data instead of the whole data. I saw one example in a book but it uses... (1 Reply)
Discussion started by: scmay
1 Replies
Login or Register to Ask a Question