Doubt regarding Select()


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Doubt regarding Select()
# 1  
Old 12-15-2007
Doubt regarding Select()

Please provide the solution for the following scenario:

1) There are two process named as ProcessA and ProcessB
2) ProcessA has opend a named pipe in read mode.This has been made as blocking mode.
3) ProcessB opens this pipe and writes in Blocking mode.So wat happens is even if Process A goes down ,ProcessB still waits
that ProcessA will come up since it is in blocking mode.

Solution tried:

1) Made the open system call as non -blocking mode

But here the problem is, when the packet size is more to be sent it keeps on writing and at one time PIPEBUFFER gets filled.



2) So we made the write system as blocking using select

when pipe buffer is full the return value is EAGAIN

code:
retval =write();
if (retval==-1)
{
if(errno==EAGAIN)
{
select()
}
}

so now when pipe buffer is full it is made to blocking,



AGAIN the problem we face is:


For example:
assume : pipe buffer size =100

according to our product, it should write only 10 bytes,assume now the pipe buffer is full

so write() system call will return EAGAIN,it goes to blocking.now even if there is a SINGLE BYTE space ,write will proceed.




kindly provide me some solution -how to fix this issue
# 2  
Old 12-15-2007
It depends what you think the issue is.

Can you clarify what you mean by named pipe, do you mean fifo or AF_UNIX socket stream.
# 3  
Old 12-15-2007
fifo - i m using mknod system call




Quote:
Originally Posted by porter
It depends what you think the issue is.

Can you clarify what you mean by named pipe, do you mean fifo or AF_UNIX socket stream.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Doubt..

Hi experts, In one of our code we have used some command like this. name=${name##*/} Can someone please let me know what exactly it does? Thanks & Regards, Sathya V. (1 Reply)
Discussion started by: Sathya83aa
1 Replies

2. Red Hat

doubt

I need help in opening the .exe files in linux. As i have downloaded ubuntu os from trail version. after executing the the file name in terminal it is stating that get archive files for opening the .exe files. But i am unable to get it please help me (2 Replies)
Discussion started by: yashwanthguru
2 Replies

3. Shell Programming and Scripting

Doubt

Hi, I have a file with multiple entries and I have calculated the percentages. Now I want to know how many of my entries are there between 1-10% 11-20% and so on.. chr1_14401_14450 0.211954217888936 chr1_14451_14500 1.90758796100042 chr1_14501_14550 4.02713013988978... (1 Reply)
Discussion started by: Diya123
1 Replies

4. Boot Loaders

Reboot and Select Proper Boot device or insert Boot media in select Boot device and press a key

Hello, I have kubuntu on my laptop and now I decided to switch to Windows 7. I made the bios settings properly (first choice is boot from cd\vd) but I see the error " reboot and select proper Boot device or insert Boot media in select Boot device and press a key " I have tried CD and... (0 Replies)
Discussion started by: rpf
0 Replies

5. UNIX for Dummies Questions & Answers

Doubt

How would i create virtual interface in linux to configure more than one IP address for a physical interface? any help wll be appreciated. (1 Reply)
Discussion started by: salil2012
1 Replies

6. Shell Programming and Scripting

Doubt??

I jus want to know the meaning of the below command line(exclamation following that re-direction) sqlplus -s `cat /home/sample.txt` <<! Thanks!! (1 Reply)
Discussion started by: nohup
1 Replies

7. UNIX for Dummies Questions & Answers

doubt on name

HI, Iam jus tin a confusion that solaris and unix are the same.if they are diffrent,how they are?pls give me a brief idea abt these two. I will be very grateful to you thanks (1 Reply)
Discussion started by: shruti_mgp
1 Replies
Login or Register to Ask a Question