How to detach socket from FILE?
Correo Fernando-ruiz (E-mail)
correo at fernando-ruiz.com
Thu Dec 6 17:29:20 UTC 2001
In my shell I have avoided the dup() call.
In order to get the same goal
I have done an UGLY stderr=stdout=stdin;
I can share the same socket while the shell task is running.
dup() spents the limited FILE table resources.
No very correct but works.
This kind of tricks are the same thing that
the COMMON BLOCK in fortran versus the structured procedural
programming avoiding the global variable side effect.
BRGDS.
Fernando RUIZ CASAS
home: correo at fernando-ruiz.com
work: fernando.ruiz at ctv.es
PS:
I am not very happy with the bad notice of Joel's father.
Dommage, Schade, Lastima,... (I don't known the english word)
> -----Mensaje original-----
> De: Sergei Organov [mailto:osv at javad.ru]
> Enviado el: jueves, 06 de diciembre de 2001 17:42
> Para: rtems-users at oarcorp.com
> Asunto: How to detach socket from FILE?
>
>
> Suppose I've got socket descriptor and have attached it to a
> FILE using
> 'fdopen()'. Now I want to 'fclose()' the FILE, but leave socket
> open. According to FreeBSD manual pages, 'fclose()' will
> close the socket.
>
> I think I can do something like this:
>
> int s;
> FILE* file;
> ....
> s = dup(fileno(file));
> fclose(file);
> ... use s ...
>
> But would 'dup' work as expected in RTEMS? Is there
> another/better way to
> achieve the same goal?
>
> Thanks in advance.
>
> Sergei.
>
>
More information about the users
mailing list