lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] the problem continious with my TCP connection socket


From: Kieran Mansley
Subject: Re: [lwip-users] the problem continious with my TCP connection socket
Date: Wed, 30 Sep 2009 09:22:20 +0100

On Tue, 2009-09-29 at 16:08 +0200, Oscar F wrote:
> sorry kieran, sorry for my english, but i donĀ“t understand

OK, you have this:

      FD_ZERO(&acceptset);
      maxfd=0;

      for(i=0;i<NUM_SOCKET;i++)
       {
        FD_SET(lSocket[i], &acceptset);
        if (lSocket[i]> maxfd)
         maxfd = lSocket[i];
       }

      while(1){
        ret = select(maxfd+1, &acceptset, NULL, NULL, NULL);

        ...
      }


You need this instead:

      while (1) {
        FD_ZERO(&acceptset);
        maxfd=0;

        for(i=0;i<NUM_SOCKET;i++)
        {
          FD_SET(lSocket[i], &acceptset);
          if (lSocket[i]> maxfd)
            maxfd = lSocket[i];
        }

        ret = select(maxfd+1, &acceptset, NULL, NULL, NULL);

        ...
      }

because acceptset is modified by the call to select, so you need to
reset it each time you call select, so you need that code in the loop.

> Can i connect in the same task(one thread) with different TCP sockets
> with different port ?
>  socket 1 port 1500H
> socket 2 port 1501H

Yes.

Kieran





reply via email to

[Prev in Thread] Current Thread [Next in Thread]