[En-Nut-Discussion] Redirection of both stdin and stdout to connected TCP socket

Gervasio Varela gervarela at picandocodigo.com
Thu Oct 26 16:10:14 CEST 2006


Hi Willem,

You can try something like these.

           socket = NutTcpCreateSocket();

           NutTcpAccept(socket, PORT);
           stream = _fdopen((int) socket, "r+b");

           stdout = stream;

           puts("whatever you want\n");

stout seems to be FILE *, so you can interchange it with a FILE * stream
open for a TCPSCOCKET.

See you.

On 25/10/06, Willem Myburgh <willem.myburgh at gmail.com> wrote:
>
> Hi Everyone
> I'm struggling to figure out how to redirect stdin and stdout to a
> connected
> TCP socket. According to the Standard I/O documentation the application
> can
> use freopen(). However, I do not see how the parameters of this function
> cater for a socket reference. What is the correct way to implement this?
>
> Kind Regards
> --
> Willem Myburgh
> South Africa
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>



-- 
###################################
#    Gervasio Varela                               #
#    gervarela at picandocodigo.com         #
#    http://www.picandocodigo.com          #
###################################



More information about the En-Nut-Discussion mailing list