LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 09-28-2005, 02:07 PM   #1
Thinking
Member
 
Registered: Oct 2003
Posts: 249

Rep: Reputation: 30
what does exception fd's mean for select();?


hiho@ll

from the man page for the select(); command

Code:
Three independent sets of descriptors are watched.   Those
       listed  in  readfds  will  be watched to see if characters
       become available for reading (more precisely, to see if  a
       read  will not block - in particular, a file descriptor is
       also ready on end-of-file),  those  in  writefds  will  be
       watched  to  see  if  a write will not block, and those in
       exceptfds will be watched for exceptions.   On  exit,  the
       sets  are  modified in place to indicate which descriptors
       actually changed status.
what are exceptions?
i'm asking because i have a descriptor proxy (or to be more exactly i have 2 proxy's)

i have 2 hosts
both hosts have applications which should do something
the applications talk to each other over my connection
this means i have

APP1 <-> MYPROXY1 <-> MYPROXY2 <-> APP2

APP1 and MYPROXY1 are HOST1
APP2 and MYPROXY2 are HOST2

why a proxy? because the proxy is something like "UnixDomainSocket to TCP/IP socket"

this means APP1 connects to a Unix domain socket server
the server creates a connection to host2
host2 starts the proxy
host1 starts the proxy
so app1 is talking to APP2 through two of my proxies
because app2 is also using a unix domain socket

the problem

if i send something from APP1 to APP2 it receives it and sends something back
then APP2 closes the connection
APP1 also closes the connection

because my proxy uses 2 threads to do full duplex read/write i have for the whole scenario 4 threads running
if APP1 closes connection
thread 1 of 4 closes
if APP2 closes connection
thread3 of 4 closes
but thread 2 and 4 are waiting for input from the other sides of the connection

so maybe i can use the exception FD's to check if one of the descriptors closed and close the connection and thread if i get an exception because of closed connection

*g*
anybody understood this?
 
Old 09-28-2005, 10:20 PM   #2
randyding
Member
 
Registered: May 2004
Posts: 552

Rep: Reputation: 31
from: man select_tut
Quote:
exceptfds
This set is watched for exceptions or errors on any of the file descriptors. However, that is actually just a rumor. How you use exceptfds is to watch for out-of-band (OOB) data.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Exception Handling C++ Hady Programming 3 07-27-2005 12:07 AM
Select() did not select my socket thvo Programming 1 05-08-2005 01:20 AM
help createing exception class from base STL exception qwijibow Programming 4 04-20-2005 06:23 AM
limiting proccesses and fd's for a user phant0m Linux - Software 1 01-30-2004 02:14 PM
Runtime Exception vs. Exception mikeshn Programming 1 09-22-2002 06:33 AM

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

All times are GMT -5. The time now is 04:57 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration