Re: send to socket: Bad file descriptor
From: Kasper Dupont (kasperd_at_daimi.au.dk)
Date: 04/27/04
- Next message: H Brett Bolen: "rh ddcprobe"
- Previous message: Kasper Dupont: "Re: Spindle speed of Hard Disk- How to find"
- In reply to: ormancey: "send to socket: Bad file descriptor"
- Next in thread: Villy Kruse: "Re: send to socket: Bad file descriptor"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 27 Apr 2004 17:04:35 +0200
ormancey wrote:
>
> hi everybody,
>
> a newbie question again
>
> i made a socket in a task
> and i read data on this socket in a child task
> i want to write data to this socket with a other child but i have this message
> send: Bad file descriptor
>
> if some one has an idea to let me write to this socket ??
Sounds like you created the child process before creating
the socket. That means the two processes will not share
file descriptors, so accessing the same file descriptor
number in the child will give a different file, or in
your case probably an unused file descriptor.
Three possible solutions:
1) Create the socket before forking
2) Share the array of filedescriptors by the use of
clone with appropriate flags
3) Pass the file descriptor over a UNIX domain socket.
(AFAIK you can do something like this, but I never
tried it myself).
-- Kasper Dupont -- der bruger for meget tid paa usenet. For sending spam use abuse@mk.lir.dk and kasperd@mk.lir.dk /* Would you like fries with that? */
- Next message: H Brett Bolen: "rh ddcprobe"
- Previous message: Kasper Dupont: "Re: Spindle speed of Hard Disk- How to find"
- In reply to: ormancey: "send to socket: Bad file descriptor"
- Next in thread: Villy Kruse: "Re: send to socket: Bad file descriptor"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|