Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Can you select() socketpair()-generated descriptors?
I'm pulling my hair out over trying to get a socket passed from one
process to another. My latest problem is in getting the receiving
process to detect the incoming socket. I'm using select() as I do with
all the socket descriptors and pipe descriptors, but it just times
out, as though the socket was never sent. If I create a set of
descriptors using socketpair(AF_UNIX, SOL_SOCKET, 0, desAncils), does
select() treat those descriptors the same as those created with
pipe(), accept() or connect()?

Report this thread to moderator Post Follow-up to this message
Old Post
Jo
09-30-04 01:07 AM


Re: Can you select() socketpair()-generated descriptors?
Jo wrote:

> I'm pulling my hair out over trying to get a socket passed from one
> process to another. My latest problem is in getting the receiving
> process to detect the incoming socket. I'm using select() as I do with
> all the socket descriptors and pipe descriptors, but it just times
> out, as though the socket was never sent. If I create a set of
> descriptors using socketpair(AF_UNIX, SOL_SOCKET, 0, desAncils), does
> select() treat those descriptors the same as those created with
> pipe(), accept() or connect()?

The second parameter to socketpair is wrong.  You should be passing a
socket type (e.g. SOCK_STREAM, SOCK_DGRAM, etc.).

--
Andrew

Report this thread to moderator Post Follow-up to this message
Old Post
Andrew Taylor
09-30-04 01:07 AM


Re: Can you select() socketpair()-generated descriptors?
> I'm using select() as I do with all the socket descriptors and pipe
> descriptors, but it just times out, as though the socket was never
> sent.

It is almost certainly a bug in your code. Did you remember to set the
first argument to select() to be the value of your largest file
descriptor PLUS one? Did you remember to re-initialize your file
descriptor masks before EVERY call to select()?

> If I create a set of descriptors using socketpair(AF_UNIX,
> SOL_SOCKET, 0, desAncils), does select() treat those descriptors the
> same as those created with pipe(), accept() or connect()?

Yes. Or open(). Or the 0, 1, and 2 descriptors automatically created
for you. As far as select() is concerned, a file descriptor is a file
descriptor is a file descriptor. You can select() on all of them.

b

Report this thread to moderator Post Follow-up to this message
Old Post
Brian Raiter
09-30-04 01:07 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Unix Programming archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:41 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.