AW: [En-Nut-Discussion] Limit to TCP connections?

def at fea.kiev.ua def at fea.kiev.ua
Thu Dec 15 17:07:59 CET 2005


> hi,
>
> i have such a similar problem with my TCP Thread.
>
> Did you have also the problem that the socket is closed by ethernut after
> 2,3 TCP Calls?
> Maybe
I explore that behavior and…
In standart httpd thread:
THREAD(Service, arg)
{
    TCPSOCKET *sock;
    FILE *stream;
	NutThreadSetPriority(254);

    for (;;) {

        if ((sock = NutTcpCreateSocket()) == 0) {
            NutSleep(5000);
            continue;
        }
        NutTcpAccept(sock, 80);
        while (NutHeapAvailable() < 8192) {
NutHeapAvailable());
            NutSleep(1000);
        }
		if ((stream = _fdopen((int) ((uptr_t) sock), "r+b")) == 0) {
			syslog(LOG_INFO, "Error opening stream… 8(");
        } else {
            NutHttpProcessRequest(stream);
            fclose(stream);
        }
        NutTcpCloseSocket(sock);
    }
}
And when I open all 3 connection, I get syslog message!!!
So, OS can’t open sock???
If I break one of connection, then http work fine, until I not connect
broken TCP connection….

>
> Joachim
>
> -----Ursprüngliche Nachricht-----
> Von: en-nut-discussion-bounces at egnite.de
> [mailto:en-nut-discussion-bounces at egnite.de]Im Auftrag von
> def at fea.kiev.ua
> Gesendet: Donnerstag, 15. Dezember 2005 11:33
> An: Ethernut User Chat
> Betreff: [En-Nut-Discussion] Limit to TCP connections?
>
>
> Hi All.
> I have such problem: I open in system three threads (on 1024 byte in a
> stack):
> NutThreadCreate("TCPClient", TCPClient, 0, 1024);
> NutThreadCreate("TCPClient0", TCPClient0, 0, 1024);
> NutThreadCreate("TCPClient1", TCPClient1, 0, 1024);
>
> Everyone threads works as TCP-client.
> Also I open WEB-server as in examples (httpd):
> for (i = 1; i <= 2; i++) {
> 	char *thname = "httpd0";
> 	thname[5] = '0' + i;
> 	NutThreadCreate(thname, Service, (void *) (uptr_t) i,
> NUT_THREAD_MAINSTACK);
> }
>
> All works normally while ALL three threads will not connect to the
> servers. As soon as it has occured - the WEB not work. That is 80 port is
> not opened 8(
>
> Use ethernut 3.9.8.
>
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>





More information about the En-Nut-Discussion mailing list