[En-Nut-Discussion] httpd + thread

Anpilogov Andrey def at fea.kiev.ua
Wed Sep 14 12:32:59 CEST 2005


Hi all!!!
I modified an example httpd and has added such thread:
THREAD(TCPClient, arg)
{
    TCPSOCKET *sock;
    FILE *stream;
    char buff[128];

    for (;;) {
        if ((sock = NutTcpCreateSocket()) != 0) {
//            if (NutTcpConnect(sock, 
inet_addr(Conf.server_ip),Conf.server_port) == 0) {
//                if ((stream = _fdopen((int) sock, "r+b")) != 0) {
                    NutSleep(15000);
//                    fclose(stream);
//                } else
//                    puts("Assigning a stream failed");
//            } else
//              puts("failed");
            NutTcpCloseSocket(sock);
        }
        NutSleep(1000);
    }
}

I start thus:
NutThreadCreate("tcp", TCPClient, 0, 192);
All works normally, but when I try to open CGI script device rebooted. 8 (

Someone collided with such problem?
Or, probably, I do something not correctly?



More information about the En-Nut-Discussion mailing list