LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-12-2005, 05:05 AM   #1
aru_04
LQ Newbie
 
Registered: Nov 2004
Posts: 24

Rep: Reputation: 15
using FIFOS in C programs


hello everybody,
I am writing a C implementation of the leaky bucket algorithm (networking)
using FIFOs in Linux.I have created 2 programs -one for the generator and one for the bucket and used 2 separate terminals for viewing inputs and outputs.Everything is moving along smoothly except the FIFOs!I am facing immense trouble using them
Any idea how fifos work internally?how reads and writes are performed on them and how i can set the ON_DELAY flag for reading from a fifo?Also,are fifos pipes or files or queues? Upon reading from a fifo, does the read element get 'deleted' or is it read again if no new elements are added?
Please help me.. there is so little material on fifos ..also the programs are part of a project.
Regards,
aru
 
Old 05-12-2005, 07:56 AM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
I assume you are using mkfifo to make yourself a fifo?

If you are you are basically created a special file. Anyone can read or write to this file (providing they hae permissions) but there are some catches. The file must be open for reading AND writting before anyone can read or write to it.

When you read off the FIFO it removes the entry you read from the FIFO.

Basically, think of a FIFO as a pipe specially linked to a file on the file system. That file doesn't actually contain the data in the FIFO, it just acts as a reference so anyone can access the FIFO.
 
Old 05-13-2005, 01:46 AM   #3
aru_04
LQ Newbie
 
Registered: Nov 2004
Posts: 24

Original Poster
Rep: Reputation: 15
thanks a lot, jtshaw!
your tips certainly helped.One more thing though.
What does the 'BROKEN PIPE' error message mean?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
chat program using fifos and pipes questioner Programming 8 05-04-2006 08:20 AM
Semaphore Library using Pipes / Fifos erdemilhan Programming 2 11-27-2004 04:18 PM
IPC (Message Queues vs. FIFOs vs. Unix-domain Sockets) TedMaul Programming 0 03-18-2004 04:53 AM
my table with programs when i press in button (left down corner) do no show programs sagi7ario Mandriva 1 03-12-2004 12:02 PM
How to get newly installed programs in programs list Brosky Linux - Software 5 02-06-2004 03:45 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration