Loading ...
Sorry, an error occurred while loading the content.

RE: [blug-prog] Sockets(Server and Client)

Expand Messages
  • Karthick Ramnarayanan
    When you use accept to accept a connection, and when a connection goes through,you get a new socket descriptor(duplicated). for(;;) { new_sd =
    Message 1 of 12 , Jan 8, 2003
    • 0 Attachment
      When you use "accept" to accept a connection,
      and when a connection goes through,you get a new socket descriptor(duplicated).
      for(;;) {
      new_sd = accept(fd,(struct sockaddr*)&server_connection,&server_size);
      Now fork a connection for each client.
      if(fork() == 0) {
      //child goes to handle the corresponding client
      handle_client(new_sd);
      exit(0);
      }
      //the parent goes back for an accept
      }
      This is a nowait situation.But if you want to wait after handling each connection,
      then you dont have to fork.
      Regards,
      -Karthick

      -----Original Message-----
      From: Rupa [mailto:rupa.ramakrishna@...]
      Sent: Thursday, January 09, 2003 12:17 PM
      To: linux-bangalore-programming@yahoogroups.com
      Subject: [blug-prog] Sockets(Server and Client)


      Hello,
      I have small doubt regarding the working of sockets in case of server and client. I am using connection oriented stream. In "backlog" option of the listen system call, I have specified 3. That is, I want server to listen to 3 client connections. How to synchronize the execution of 3 clients. I want to know the outline of the server program to synchronize the execution.

      Regards,
      Rupa

      [Non-text portions of this message have been removed]





      ---------------------------------------------------------------
      This is the programming list of the Bangalore Linux Users Group
      ---------------------------------------------------------------
      Go to http://linux-bangalore.org for more information
      about us, as well as our other mailing lists

      Before you post to this list, please read
      http://linux-bangalore.org/articles/smart-questions.php


      Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    • Rupa
      Synchronization between clients. As only one request at a time is handled by the server. Is it possible to check which client is being currently serviced by
      Message 2 of 12 , Jan 9, 2003
      • 0 Attachment
        Synchronization between clients. As only one request at a time is handled by the server. Is it possible to check which client is being currently serviced by the server?.

        Rupa
        ----- Original Message -----
        From: Harish V. Kulkarni
        To: linux-bangalore-programming@yahoogroups.com
        Sent: Thursday, January 09, 2003 2:12 PM
        Subject: RE: [blug-prog] Sockets(Server and Client)



        hi!,
        What exactly you mean by synchronize. is it synchronization of memory or
        handling of any other resource. In any synchronization, semaphores can be
        used, if server supports concurrent clients ( where each client will be
        handled by a separate process) or thread mutex keys can be used if server
        supports threads for each client.
        I got confused @ first instance!!.
        Hari

        -----Original Message-----
        From: Rupa [mailto:rupa.ramakrishna@...]
        Sent: Thursday, January 09, 2003 12:17 PM
        To: linux-bangalore-programming@yahoogroups.com
        Subject: [blug-prog] Sockets(Server and Client)


        Hello,
        I have small doubt regarding the working of sockets in case of server
        and client. I am using connection oriented stream. In "backlog" option of
        the listen system call, I have specified 3. That is, I want server to listen
        to 3 client connections. How to synchronize the execution of 3 clients. I
        want to know the outline of the server program to synchronize the execution.

        Regards,
        Rupa

        [Non-text portions of this message have been removed]




        ---------------------------------------------------------------
        This is the programming list of the Bangalore Linux Users Group
        ---------------------------------------------------------------
        Go to http://linux-bangalore.org for more information
        about us, as well as our other mailing lists

        Before you post to this list, please read
        http://linux-bangalore.org/articles/smart-questions.php


        Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


        [Non-text portions of this message have been removed]




        ---------------------------------------------------------------
        This is the programming list of the Bangalore Linux Users Group
        ---------------------------------------------------------------
        Go to http://linux-bangalore.org for more information
        about us, as well as our other mailing lists

        Before you post to this list, please read
        http://linux-bangalore.org/articles/smart-questions.php


        Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


        [Non-text portions of this message have been removed]
      • Rupa
        Can we print the ipaddress of the client once we got connection inside the accept system call?. I think by this we will come to know which client is currently
        Message 3 of 12 , Jan 9, 2003
        • 0 Attachment
          Can we print the ipaddress of the client once we got connection inside the accept system call?. I think by this we will come to know which client is currently handled by the server.
          Please correct me if I am wrong.

          Rupa
          ----- Original Message -----
          From: Karthick Ramnarayanan
          To: linux-bangalore-programming@yahoogroups.com
          Sent: Thursday, January 09, 2003 1:05 PM
          Subject: RE: [blug-prog] Sockets(Server and Client)


          When you use "accept" to accept a connection,
          and when a connection goes through,you get a new socket descriptor(duplicated).
          for(;;) {
          new_sd = accept(fd,(struct sockaddr*)&server_connection,&server_size);
          Now fork a connection for each client.
          if(fork() == 0) {
          //child goes to handle the corresponding client
          handle_client(new_sd);
          exit(0);
          }
          //the parent goes back for an accept
          }
          This is a nowait situation.But if you want to wait after handling each connection,
          then you dont have to fork.
          Regards,
          -Karthick

          -----Original Message-----
          From: Rupa [mailto:rupa.ramakrishna@...]
          Sent: Thursday, January 09, 2003 12:17 PM
          To: linux-bangalore-programming@yahoogroups.com
          Subject: [blug-prog] Sockets(Server and Client)


          Hello,
          I have small doubt regarding the working of sockets in case of server and client. I am using connection oriented stream. In "backlog" option of the listen system call, I have specified 3. That is, I want server to listen to 3 client connections. How to synchronize the execution of 3 clients. I want to know the outline of the server program to synchronize the execution.

          Regards,
          Rupa

          [Non-text portions of this message have been removed]





          ---------------------------------------------------------------
          This is the programming list of the Bangalore Linux Users Group
          ---------------------------------------------------------------
          Go to http://linux-bangalore.org for more information
          about us, as well as our other mailing lists

          Before you post to this list, please read
          http://linux-bangalore.org/articles/smart-questions.php


          Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/





          ---------------------------------------------------------------
          This is the programming list of the Bangalore Linux Users Group
          ---------------------------------------------------------------
          Go to http://linux-bangalore.org for more information
          about us, as well as our other mailing lists

          Before you post to this list, please read
          http://linux-bangalore.org/articles/smart-questions.php


          Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


          [Non-text portions of this message have been removed]
        • nerdboy by way of nerdboy
          this synchronize thing is kinda arbit. anyway, presume you wanna listen for al the 3 clients simultaneously. you could use the select system call() that waits
          Message 4 of 12 , Jan 9, 2003
          • 0 Attachment
            this synchronize thing is kinda arbit.

            anyway, presume you wanna listen for al the 3 clients simultaneously.

            you could use the select system call() that waits for a number of file
            descriptors to change status.

            headers:
            either
            #include <sys/select.h>

            or
            #include <sys/time.h>
            #include <sys/types.h>
            #include <unistd.h>

            int select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
            struct timeval *timeout);

            do a 'man select' for further info.
            the outline of the program (pseudocode) would be someting like :
            //this part is where you have to listen for those 3 connections
            while(1)
            {
            printf("\nlistening for connections..");

            highfd=-1;
            FD_ZERO(&readfds);//initialize the fd set to be listened to..

            FD_SET(fd1, &readfds);//add fd1 to be listened to..
            FD_SET(fd2, &readfds);
            FD_SET(fd3, &readfds);

            if(max(fd1,fd2,fd3) > highfd)//max fn() calculates the max of the 3 fd's
            highfd=max(fd1,fd2,fd3);

            wait_time.tv_sec = 0;
            wait_time.tv_usec = 50;//wait for say 50 micro secs..

            retval = select(highfd + 1, &readfds, NULL, NULL, &wait_time);
            //cos highfd is always 1 plus the highest fd to be listened for
            if(retval>0)
            {
            printf("\nData on socket detected");
            readSockData(highfd);//fn() to read data from that socket and process ...
            }

            else if(retval==EBADF || retval==EINTR ||retval==EINVAL || retval==ENOMEM)
            {
            printf("\nSelect Socket Error...\n");
            exit(1);
            }

            }

            On Thursday 09 January 2003 12:16, Rupa wrote:
            > Hello,
            > I have small doubt regarding the working of sockets in case of server
            > and client. I am using connection oriented stream. In "backlog" option of
            > the listen system call, I have specified 3. That is, I want server to
            > listen to 3 client connections. How to synchronize the execution of 3
            > clients. I want to know the outline of the server program to synchronize
            > the execution.
            >
            > Regards,
            > Rupa
          • Nikhil Kale
            backlog specifies the _SUM_ of the number of ESTABLISHED connections and number of PENDING (incomplete) connections. Regards, Nikhil Kale ... From: Kiran
            Message 5 of 12 , Jan 9, 2003
            • 0 Attachment
              "backlog" specifies the _SUM_ of the number of ESTABLISHED connections and number of PENDING (incomplete) connections.

              Regards,
              Nikhil Kale

              ----- Original Message -----
              From: Kiran Kumar <immidi_kiran@...>
              Date: Thu, 9 Jan 2003 00:25:18 -0800 (PST)
              To: linux-bangalore-programming@yahoogroups.com
              Subject: Re: [blug-prog] Sockets(Server and Client)

              <html><body>


              <tt>
              Hi,<BR>
              I suppose the backlog is not to limit the number of<BR>
              clients that a server can talk to. It would specify<BR>
              the 'backlog', i.e., "maximum length the queue of<BR>
              pending connections". If when a client connection is<BR>
              being serviced, further connections arrive, these are<BR>
              made to wait in a queue. The limit of this queue is<BR>
              the backlog. Thus you could have a server servicing n<BR>
              number of clients, with its backlog as 3 (or<BR>
              whatever). <BR>
              To limit your server to 3 connections, you will have<BR>
              to use some other way like a global variable, or<BR>
              whatever.<BR>
              Correct me if I am wrong or got the question wrong.<BR>
              Regards,<BR>
              Kiran Kumar Immidi<BR>
              <BR>
              --- Rupa <rupa.ramakrishna@...> wrote:<BR>
              > Hello,<BR>
              > I have small doubt regarding the working of<BR>
              > sockets in case of server and client. I am using<BR>
              > connection oriented stream. In "backlog" option of<BR>
              > the listen system call, I have specified 3. That is,<BR>
              > I want server to listen to 3 client connections. How<BR>
              > to synchronize the execution of 3 clients. I want to<BR>
              > know the outline of the server program to<BR>
              > synchronize the execution.<BR>
              > <BR>
              > Regards,<BR>
              > Rupa<BR>
              > <BR>
              > [Non-text portions of this message have been<BR>
              > removed]<BR>
              > <BR>
              > <BR>
              > <BR>
              <BR>
              __________________________________________________<BR>
              Do you Yahoo!?<BR>
              Yahoo! Mail Plus - Powerful. Affordable. Sign up now.<BR>
              <a href="http://mailplus.yahoo.com">http://mailplus.yahoo.com</a><BR>
              <BR>
              </tt>


              <br>
              <tt>
              <BR>
              ---------------------------------------------------------------<BR>
              This is the programming list of the Bangalore Linux Users Group<BR>
              ---------------------------------------------------------------<BR>
              Go to <a href="http://linux-bangalore.org">http://linux-bangalore.org</a> for more information <BR>
              about us, as well as our other mailing lists<BR>
              <BR>
              Before you post to this list, please read<BR>
              <a href="http://linux-bangalore.org/articles/smart-questions.php">http://linux-bangalore.org/articles/smart-questions.php</a><BR>
              </tt>
              <br>

              <br>
              <tt>Your use of Yahoo! Groups is subject to the <a href="http://docs.yahoo.com/info/terms/">Yahoo! Terms of Service</a>.</tt>
              </br>

              </body></html>


              --
              ______________________________________________
              http://www.linuxmail.org/
              Now with POP3/IMAP access for only US$19.95/yr

              Powered by Outblaze
            • Harish V. Kulkarni
              hi!, Not clear again!!, you want some thing like who is servered by the server presently!!, but this indication is accessed by user in which way??, you can
              Message 6 of 12 , Jan 9, 2003
              • 0 Attachment
                hi!,
                Not clear again!!, you want some thing like who is servered by the server
                presently!!, but this indication is accessed by user in which way??,
                you can identify each client by the connected Ipv4/Ipv6 address and port,
                when-ever server accepts a client, store the name, and when-ever
                a particular service needs to be used, let the server set for which client
                the server is serving.

                let's say, you have 3 clients, connected presently, and during accept()
                success story for each of the client, you have maintained a list,
                of clients, and there respective fd's
                /* i am assuming that stdout,stdin,stderr and serverSocket are open and
                active*/
                fd = 4 <=======> "client1"
                fd = 5 <=======> "client2"
                fd = 6 <=======> "client3"

                before you enter the critical section ( or the code/function) where
                services are supported by the server, just store the
                "clientname" which is using the service, when the server completes servicing
                the client request, just come of and clean the stored client info.

                Make sure the other clients, don't update the ServingClient information
                availability. ( use semaphore tobe assured about the same!!)

                NOTE: if another process is wants to know, then ooooooooooh!!!, signals,
                write a signal routine which will print the content of
                presently stored client name.
                Or, yaa, i got an idea, store the "clientname", which is getting served in a
                shared memory and let the other processes read
                when-ever they want to know, which client is being servered presently.
                -
                Hari

                PS: looks like a bug is eating you............................in this case
                just use signal, and print the name of the client!!!.


                -----Original Message-----
                From: Rupa [mailto:rupa.ramakrishna@...]
                Sent: Thursday, January 09, 2003 3:11 PM
                To: linux-bangalore-programming@yahoogroups.com
                Subject: Re: [blug-prog] Sockets(Server and Client)


                Synchronization between clients. As only one request at a time is
                handled by the server. Is it possible to check which client is being
                currently serviced by the server?.

                Rupa
                ----- Original Message -----
                From: Harish V. Kulkarni
                To: linux-bangalore-programming@yahoogroups.com
                Sent: Thursday, January 09, 2003 2:12 PM
                Subject: RE: [blug-prog] Sockets(Server and Client)



                hi!,
                What exactly you mean by synchronize. is it synchronization of memory or
                handling of any other resource. In any synchronization, semaphores can
                be
                used, if server supports concurrent clients ( where each client will be
                handled by a separate process) or thread mutex keys can be used if
                server
                supports threads for each client.
                I got confused @ first instance!!.
                Hari

                -----Original Message-----
                From: Rupa [mailto:rupa.ramakrishna@...]
                Sent: Thursday, January 09, 2003 12:17 PM
                To: linux-bangalore-programming@yahoogroups.com
                Subject: [blug-prog] Sockets(Server and Client)


                Hello,
                I have small doubt regarding the working of sockets in case of
                server
                and client. I am using connection oriented stream. In "backlog" option
                of
                the listen system call, I have specified 3. That is, I want server to
                listen
                to 3 client connections. How to synchronize the execution of 3 clients.
                I
                want to know the outline of the server program to synchronize the
                execution.

                Regards,
                Rupa

                [Non-text portions of this message have been removed]




                ---------------------------------------------------------------
                This is the programming list of the Bangalore Linux Users Group
                ---------------------------------------------------------------
                Go to http://linux-bangalore.org for more information
                about us, as well as our other mailing lists

                Before you post to this list, please read
                http://linux-bangalore.org/articles/smart-questions.php


                Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


                [Non-text portions of this message have been removed]




                ---------------------------------------------------------------
                This is the programming list of the Bangalore Linux Users Group
                ---------------------------------------------------------------
                Go to http://linux-bangalore.org for more information
                about us, as well as our other mailing lists

                Before you post to this list, please read
                http://linux-bangalore.org/articles/smart-questions.php


                Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


                [Non-text portions of this message have been removed]



                ---------------------------------------------------------------
                This is the programming list of the Bangalore Linux Users Group
                ---------------------------------------------------------------
                Go to http://linux-bangalore.org for more information
                about us, as well as our other mailing lists

                Before you post to this list, please read
                http://linux-bangalore.org/articles/smart-questions.php


                Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


                [Non-text portions of this message have been removed]
              • Kiran Kumar
                From Beej guide to n/w prog The listen call is fairly simple, but requires a bit of explanation: int listen(int sockfd, int backlog); sockfd is the
                Message 7 of 12 , Jan 9, 2003
                • 0 Attachment
                  From Beej guide to n/w prog
                  <quote>
                  The listen call is fairly simple, but requires a bit
                  of explanation:

                  int listen(int sockfd, int backlog);

                  sockfd is the usual socket file descriptor from the
                  socket() system call. "backlog is the number of
                  connections allowed on the incoming queue. What does
                  that mean? Well, incoming connections are going to
                  wait in this queue until you accept() them (see below)
                  and _this_ is the limit on how many can _queue_ up."
                  Most systems silently limit this number to about 20;
                  you can probably get away with setting it to 5 or 10.
                  </quote>
                  Refer to
                  http://www.ecst.csuchico.edu/~beej/guide/net/html/syscalls.html#listen
                  Regards,
                  Kiran Kumar Immidi

                  --- Nikhil Kale <nikhilkale@...> wrote:
                  > "backlog" specifies the _SUM_ of the number of
                  > ESTABLISHED connections and number of PENDING
                  > (incomplete) connections.
                  >
                  > Regards,
                  > Nikhil Kale
                  >
                  > ----- Original Message -----
                  > From: Kiran Kumar <immidi_kiran@...>
                  > Date: Thu, 9 Jan 2003 00:25:18 -0800 (PST)
                  > To: linux-bangalore-programming@yahoogroups.com
                  > Subject: Re: [blug-prog] Sockets(Server and Client)
                  >
                  > <html><body>
                  >
                  >
                  > <tt>
                  > Hi,<BR>
                  > I suppose the backlog is not to limit the number
                  > of<BR>
                  > clients that a server can talk to. It would
                  > specify<BR>
                  > the 'backlog', i.e., "maximum length the queue
                  > of<BR>
                  > pending connections". If when a client connection
                  > is<BR>
                  > being serviced, further connections arrive, these
                  > are<BR>
                  > made to wait in a queue. The limit of this queue
                  > is<BR>
                  > the backlog. Thus you could have a server servicing
                  > n<BR>
                  > number of clients, with its backlog as 3 (or<BR>
                  > whatever). <BR>
                  > To limit your server to 3 connections, you will
                  > have<BR>
                  > to use some other way like a global variable, or<BR>
                  > whatever.<BR>
                  > Correct me if I am wrong or got the question
                  > wrong.<BR>
                  > Regards,<BR>
                  > Kiran Kumar Immidi<BR>
                  > <BR>
                  > --- Rupa <rupa.ramakrishna@...> wrote:<BR>
                  > > Hello,<BR>
                  > > I have small doubt regarding the working
                  > of<BR>
                  > > sockets in case of server and client. I am
                  > using<BR>
                  > > connection oriented stream. In "backlog" option
                  > of<BR>
                  > > the listen system call, I have specified 3. That
                  > is,<BR>
                  > > I want server to listen to 3 client connections.
                  > How<BR>
                  > > to synchronize the execution of 3 clients. I want
                  > to<BR>
                  > > know the outline of the server program to<BR>
                  > > synchronize the execution.<BR>
                  > > <BR>
                  > > Regards,<BR>
                  > > Rupa<BR>
                  > > <BR>
                  > > [Non-text portions of this message have been<BR>
                  > > removed]<BR>
                  > > <BR>
                  > > <BR>
                  > > <BR>
                  > <BR>
                  >
                  __________________________________________________<BR>
                  > Do you Yahoo!?<BR>
                  > Yahoo! Mail Plus - Powerful. Affordable. Sign up
                  > now.<BR>
                  > <a
                  >
                  href="http://mailplus.yahoo.com">http://mailplus.yahoo.com</a><BR>
                  > <BR>
                  > </tt>
                  >
                  >
                  > <br>
                  > <tt>
                  > <BR>
                  >
                  ---------------------------------------------------------------<BR>
                  > This is the programming list of the Bangalore Linux
                  > Users Group<BR>
                  >
                  ---------------------------------------------------------------<BR>
                  > Go to <a
                  >
                  href="http://linux-bangalore.org">http://linux-bangalore.org</a>
                  > for more information <BR>
                  > about us, as well as our other mailing
                  > lists<BR>
                  > <BR>
                  > Before you post to this list, please
                  > read<BR>
                  > <a
                  >
                  href="http://linux-bangalore.org/articles/smart-questions.php">http://linux-bangalore.org/articles/smart-questions.php</a><BR>
                  > </tt>
                  > <br>
                  >
                  > <br>
                  > <tt>Your use of Yahoo! Groups is subject to the <a
                  > href="http://docs.yahoo.com/info/terms/">Yahoo!
                  > Terms of Service</a>.</tt>
                  > </br>
                  >
                  > </body></html>
                  >
                  >
                  > --
                  > ______________________________________________
                  > http://www.linuxmail.org/
                  > Now with POP3/IMAP access for only US$19.95/yr
                  >
                  > Powered by Outblaze
                  >
                  >

                  __________________________________________________
                  Do you Yahoo!?
                  Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
                  http://mailplus.yahoo.com
                • Harish V. Kulkarni
                  hi!, Nikhil, can you plz, specify how we can access this information ( _SUM_) for a listen socket. (i.e call and args ) Hari ... From: Nikhil Kale
                  Message 8 of 12 , Jan 9, 2003
                  • 0 Attachment
                    hi!, Nikhil,
                    can you plz, specify how we can access this information ( _SUM_) for a
                    listen socket. (i.e call and args )
                    Hari

                    -----Original Message-----
                    From: Nikhil Kale [mailto:nikhilkale@...]
                    Sent: Thursday, January 09, 2003 4:12 PM
                    To: linux-bangalore-programming@yahoogroups.com
                    Subject: Re: [blug-prog] Sockets(Server and Client)


                    "backlog" specifies the _SUM_ of the number of ESTABLISHED connections and
                    number of PENDING (incomplete) connections.

                    Regards,
                    Nikhil Kale

                    ----- Original Message -----
                    From: Kiran Kumar <immidi_kiran@...>
                    Date: Thu, 9 Jan 2003 00:25:18 -0800 (PST)
                    To: linux-bangalore-programming@yahoogroups.com
                    Subject: Re: [blug-prog] Sockets(Server and Client)

                    <html><body>


                    <tt>
                    Hi,<BR>
                    I suppose the backlog is not to limit the number of<BR>
                    clients that a server can talk to. It would specify<BR>
                    the 'backlog', i.e., "maximum length the queue of<BR>
                    pending connections". If when a client connection is<BR>
                    being serviced, further connections arrive, these are<BR>
                    made to wait in a queue. The limit of this queue is<BR>
                    the backlog. Thus you could have a server servicing n<BR>
                    number of clients, with its backlog as 3 (or<BR>
                    whatever). <BR>
                    To limit your server to 3 connections, you will have<BR>
                    to use some other way like a global variable, or<BR>
                    whatever.<BR>
                    Correct me if I am wrong or got the question wrong.<BR>
                    Regards,<BR>
                    Kiran Kumar Immidi<BR>
                    <BR>
                    --- Rupa <rupa.ramakrishna@...> wrote:<BR>
                    > Hello,<BR>
                    > I have small doubt regarding the working of<BR>
                    > sockets in case of server and client. I am using<BR>
                    > connection oriented stream. In "backlog" option of<BR>
                    > the listen system call, I have specified 3. That is,<BR>
                    > I want server to listen to 3 client connections. How<BR>
                    > to synchronize the execution of 3 clients. I want to<BR>
                    > know the outline of the server program to<BR>
                    > synchronize the execution.<BR>
                    > <BR>
                    > Regards,<BR>
                    > Rupa<BR>
                    > <BR>
                    > [Non-text portions of this message have been<BR>
                    > removed]<BR>
                    > <BR>
                    > <BR>
                    > <BR>
                    <BR>
                    __________________________________________________<BR>
                    Do you Yahoo!?<BR>
                    Yahoo! Mail Plus - Powerful. Affordable. Sign up now.<BR>
                    <a href="http://mailplus.yahoo.com">http://mailplus.yahoo.com</a><BR>
                    <BR>
                    </tt>


                    <br>
                    <tt>
                    <BR>
                    ---------------------------------------------------------------<BR>
                    This is the programming list of the Bangalore Linux Users Group<BR>
                    ---------------------------------------------------------------<BR>
                    Go to <a
                    href="http://linux-bangalore.org">http://linux-bangalore.org</a> for more
                    information <BR>
                    about us, as well as our other mailing lists<BR>
                    <BR>
                    Before you post to this list, please read<BR>
                    <a
                    href="http://linux-bangalore.org/articles/smart-questions.php">http://linux-
                    bangalore.org/articles/smart-questions.php</a><BR>
                    </tt>
                    <br>

                    <br>
                    <tt>Your use of Yahoo! Groups is subject to the <a
                    href="http://docs.yahoo.com/info/terms/">Yahoo! Terms of Service</a>.</tt>
                    </br>

                    </body></html>


                    --
                    ______________________________________________
                    http://www.linuxmail.org/
                    Now with POP3/IMAP access for only US$19.95/yr

                    Powered by Outblaze



                    ---------------------------------------------------------------
                    This is the programming list of the Bangalore Linux Users Group
                    ---------------------------------------------------------------
                    Go to http://linux-bangalore.org for more information
                    about us, as well as our other mailing lists

                    Before you post to this list, please read
                    http://linux-bangalore.org/articles/smart-questions.php


                    Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


                    [Non-text portions of this message have been removed]
                  • Nikhil Kale
                    I dont get what you mean by accessing the information ... in the listens call you SPECIFY the total number of connections (completed connection queue &
                    Message 9 of 12 , Jan 9, 2003
                    • 0 Attachment
                      I dont get what you mean by accessing the information ...
                      in the listens call you SPECIFY the total number of connections (completed connection queue & incomplete connections queue) for your listening socket.
                      You'll find more info abt this in Netork Programming - Richard Stevens (pg 93 to be specific).


                      Regards,
                      Nikhil Kale

                      ----- Original Message -----
                      From: "Harish V. Kulkarni" <harishvk@...>
                      Date: Thu, 9 Jan 2003 17:31:36 +0530
                      To: <linux-bangalore-programming@yahoogroups.com>
                      Subject: RE: [blug-prog] Sockets(Server and Client)

                      <html><body>


                      <tt>
                      hi!, Nikhil,<BR>
                      can you plz, specify how we can access this information ( _SUM_) for a<BR>
                      listen socket. (i.e call and args )<BR>
                      Hari<BR>
                      <BR>
                      -----Original Message-----<BR>
                      From: Nikhil Kale [mailto:nikhilkale@...]<BR>
                      Sent: Thursday, January 09, 2003 4:12 PM<BR>
                      To: linux-bangalore-programming@yahoogroups.com<BR>
                      Subject: Re: [blug-prog] Sockets(Server and Client)<BR>
                      <BR>
                      <BR>
                      "backlog" specifies the _SUM_ of the number of ESTABLISHED connections and<BR>
                      number of PENDING (incomplete) connections.<BR>
                      <BR>
                      Regards,<BR>
                      Nikhil Kale<BR>
                      <BR>
                      ----- Original Message -----<BR>
                      From: Kiran Kumar <immidi_kiran@...><BR>
                      Date: Thu, 9 Jan 2003 00:25:18 -0800 (PST)<BR>
                      To: linux-bangalore-programming@yahoogroups.com<BR>
                      Subject: Re: [blug-prog] Sockets(Server and Client)<BR>
                      <BR>
                      <html><body><BR>
                      <BR>
                      <BR>
                      <tt><BR>
                      Hi,<BR><BR>
                      I suppose the backlog is not to limit the number of<BR><BR>
                      clients that a server can talk to. It would specify<BR><BR>
                      the 'backlog', i.e., "maximum length the queue of<BR><BR>
                      pending connections". If when a client connection is<BR><BR>
                      being serviced, further connections arrive, these are<BR><BR>
                      made to wait in a queue. The limit of this queue is<BR><BR>
                      the backlog. Thus you could have a server servicing n<BR><BR>
                      number of clients, with its backlog as 3 (or<BR><BR>
                      whatever). <BR><BR>
                      To limit your server to 3 connections, you will have<BR><BR>
                      to use some other way like a global variable, or<BR><BR>
                      whatever.<BR><BR>
                      Correct me if I am wrong or got the question wrong.<BR><BR>
                      Regards,<BR><BR>
                      Kiran Kumar Immidi<BR><BR>
                      <BR><BR>
                      --- Rupa <rupa.ramakrishna@...> wrote:<BR><BR>
                      > Hello,<BR><BR>
                      > I have small doubt regarding the working of<BR><BR>
                      > sockets in case of server and client. I am using<BR><BR>
                      > connection oriented stream. In "backlog" option of<BR><BR>
                      > the listen system call, I have specified 3. That is,<BR><BR>
                      > I want server to listen to 3 client connections. How<BR><BR>
                      > to synchronize the execution of 3 clients. I want to<BR><BR>
                      > know the outline of the server program to<BR><BR>
                      > synchronize the execution.<BR><BR>
                      > <BR><BR>
                      > Regards,<BR><BR>
                      > Rupa<BR><BR>
                      > <BR><BR>
                      > [Non-text portions of this message have been<BR><BR>
                      > removed]<BR><BR>
                      > <BR><BR>
                      > <BR><BR>
                      > <BR><BR>
                      <BR><BR>
                      __________________________________________________<BR><BR>
                      Do you Yahoo!?<BR><BR>
                      Yahoo! Mail Plus - Powerful. Affordable. Sign up now.<BR><BR>
                      <a href="<a href="http://mailplus.yahoo.com">http://mailplus.yahoo.com</a>"><a href="http://mailplus.yahoo.com">http://mailplus.yahoo.com</a></a><BR><BR>
                      <BR><BR>
                      </tt><BR>
                      <BR>
                      <BR>
                      <br><BR>
                      <tt><BR>
                      <BR><BR>
                      ---------------------------------------------------------------<BR><BR>
                      This is the programming list of the Bangalore Linux Users Group<BR><BR>
                      ---------------------------------------------------------------<BR><BR>
                      Go to <a<BR>
                      href="<a href="http://linux-bangalore.org">http://linux-bangalore.org</a>"><a href="http://linux-bangalore.org">http://linux-bangalore.org</a></a> for more<BR>
                      information <BR><BR>
                      about us, as well as our other mailing lists<BR><BR>
                      <BR><BR>
                      Before you post to this list, please read<BR><BR>
                      <a<BR>
                      href="<a href="http://linux-bangalore.org/articles/smart-questions.php">http://linux-bangalore.org/articles/smart-questions.php</a>"><a href="http://linux-">http://linux-</a><BR>
                      bangalore.org/articles/smart-questions.php</a><BR><BR>
                      </tt><BR>
                      <br><BR>
                      <BR>
                      <br><BR>
                      <tt>Your use of Yahoo! Groups is subject to the <a<BR>
                      href="<a href="http://docs.yahoo.com/info/terms/">http://docs.yahoo.com/info/terms/</a>">Yahoo! Terms of Service</a>.</tt><BR>
                      </br><BR>
                      <BR>
                      </body></html><BR>
                      <BR>
                      <BR>
                      --<BR>
                      ______________________________________________<BR>
                      <a href="http://www.linuxmail.org/">http://www.linuxmail.org/</a><BR>
                      Now with POP3/IMAP access for only US$19.95/yr<BR>
                      <BR>
                      Powered by Outblaze<BR>
                      <BR>
                      <BR>
                      <BR>
                      ---------------------------------------------------------------<BR>
                      This is the programming list of the Bangalore Linux Users Group<BR>
                      ---------------------------------------------------------------<BR>
                      Go to <a href="http://linux-bangalore.org">http://linux-bangalore.org</a> for more information<BR>
                      about us, as well as our other mailing lists<BR>
                      <BR>
                      Before you post to this list, please read<BR>
                      <a href="http://linux-bangalore.org/articles/smart-questions.php">http://linux-bangalore.org/articles/smart-questions.php</a><BR>
                      <BR>
                      <BR>
                      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.<BR>
                      <BR>
                      <BR>
                      [Non-text portions of this message have been removed]<BR>
                      <BR>
                      <BR>
                      </tt>


                      <br>
                      <tt>
                      <BR>
                      ---------------------------------------------------------------<BR>
                      This is the programming list of the Bangalore Linux Users Group<BR>
                      ---------------------------------------------------------------<BR>
                      Go to <a href="http://linux-bangalore.org">http://linux-bangalore.org</a> for more information <BR>
                      about us, as well as our other mailing lists<BR>
                      <BR>
                      Before you post to this list, please read<BR>
                      <a href="http://linux-bangalore.org/articles/smart-questions.php">http://linux-bangalore.org/articles/smart-questions.php</a><BR>
                      </tt>
                      <br>

                      <br>
                      <tt>Your use of Yahoo! Groups is subject to the <a href="http://docs.yahoo.com/info/terms/">Yahoo! Terms of Service</a>.</tt>
                      </br>

                      </body></html>


                      --
                      ______________________________________________
                      http://www.linuxmail.org/
                      Now with POP3/IMAP access for only US$19.95/yr

                      Powered by Outblaze
                    • Harish V. Kulkarni
                      sorry for not framing the question correctly, i wanted to know about (ANY) system call/lib api, which can provide me number of clients in the listen queue
                      Message 10 of 12 , Jan 9, 2003
                      • 0 Attachment
                        sorry for not framing the question correctly, i wanted to know about (ANY)
                        system call/lib api, which can provide me
                        number of clients in the listen queue waiting for server socket acceptance.
                        Hope i am clear this time.
                        Hari

                        -----Original Message-----
                        From: Nikhil Kale [mailto:nikhilkale@...]
                        Sent: Thursday, January 09, 2003 6:42 PM
                        To: linux-bangalore-programming@yahoogroups.com
                        Subject: RE: [blug-prog] Sockets(Server and Client)


                        I dont get what you mean by accessing the information ...
                        in the listens call you SPECIFY the total number of connections
                        (completed connection queue & incomplete connections queue) for your
                        listening socket.
                        You'll find more info abt this in Netork Programming - Richard Stevens (pg
                        93 to be specific).


                        Regards,
                        Nikhil Kale

                        ----- Original Message -----
                        From: "Harish V. Kulkarni" <harishvk@...>
                        Date: Thu, 9 Jan 2003 17:31:36 +0530
                        To: <linux-bangalore-programming@yahoogroups.com>
                        Subject: RE: [blug-prog] Sockets(Server and Client)

                        <html><body>


                        <tt>
                        hi!, Nikhil,<BR>
                        can you plz, specify how we can access this information ( _SUM_) for a<BR>
                        listen socket. (i.e call and args )<BR>
                        Hari<BR>
                        <BR>
                        -----Original Message-----<BR>
                        From: Nikhil Kale [mailto:nikhilkale@...]<BR>
                        Sent: Thursday, January 09, 2003 4:12 PM<BR>
                        To: linux-bangalore-programming@yahoogroups.com<BR>
                        Subject: Re: [blug-prog] Sockets(Server and Client)<BR>
                        <BR>
                        <BR>
                        "backlog" specifies the _SUM_ of the number of ESTABLISHED connections
                        and<BR>
                        number of PENDING (incomplete) connections.<BR>
                        <BR>
                        Regards,<BR>
                        Nikhil Kale<BR>
                        <BR>
                        ----- Original Message -----<BR>
                        From: Kiran Kumar <immidi_kiran@...><BR>
                        Date: Thu, 9 Jan 2003 00:25:18 -0800 (PST)<BR>
                        To: linux-bangalore-programming@yahoogroups.com<BR>
                        Subject: Re: [blug-prog] Sockets(Server and Client)<BR>
                        <BR>
                        <html><body><BR>
                        <BR>
                        <BR>
                        <tt><BR>
                        Hi,<BR><BR>
                        I suppose the backlog is not to limit the number of<BR><BR>
                        clients that a server can talk to. It would specify<BR><BR>
                        the 'backlog', i.e., "maximum length the queue of<BR><BR>
                        pending connections". If when a client connection is<BR><BR>
                        being serviced, further connections arrive, these are<BR><BR>
                        made to wait in a queue. The limit of this queue is<BR><BR>
                        the backlog. Thus you could have a server servicing n<BR><BR>
                        number of clients, with its backlog as 3 (or<BR><BR>
                        whatever). <BR><BR>
                        To limit your server to 3 connections, you will have<BR><BR>
                        to use some other way like a global variable, or<BR><BR>
                        whatever.<BR><BR>
                        Correct me if I am wrong or got the question wrong.<BR><BR>
                        Regards,<BR><BR>
                        Kiran Kumar Immidi<BR><BR>
                        <BR><BR>
                        --- Rupa <rupa.ramakrishna@...> wrote:<BR><BR>
                        > Hello,<BR><BR>
                        > I have small doubt regarding the working of<BR><BR>
                        > sockets in case of server and client. I am using<BR><BR>
                        > connection oriented stream. In "backlog" option of<BR><BR>
                        > the listen system call, I have specified 3. That is,<BR><BR>
                        > I want server to listen to 3 client connections. How<BR><BR>
                        > to synchronize the execution of 3 clients. I want to<BR><BR>
                        > know the outline of the server program to<BR><BR>
                        > synchronize the execution.<BR><BR>
                        > <BR><BR>
                        > Regards,<BR><BR>
                        > Rupa<BR><BR>
                        > <BR><BR>
                        > [Non-text portions of this message have been<BR><BR>
                        > removed]<BR><BR>
                        > <BR><BR>
                        > <BR><BR>
                        > <BR><BR>
                        <BR><BR>
                        __________________________________________________<BR><BR>
                        Do you Yahoo!?<BR><BR>
                        Yahoo! Mail Plus - Powerful. Affordable. Sign up now.<BR><BR>
                        <a href="<a
                        href="http://mailplus.yahoo.com">http://mailplus.yahoo.com</a>"><a
                        href="http://mailplus.yahoo.com">http://mailplus.yahoo.com</a></a><BR><BR>
                        <BR><BR>
                        </tt><BR>
                        <BR>
                        <BR>
                        <br><BR>
                        <tt><BR>
                        <BR><BR>
                        ---------------------------------------------------------------<BR><BR>
                        This is the programming list of the Bangalore Linux Users Group<BR><BR>
                        ---------------------------------------------------------------<BR><BR>
                        Go to <a<BR>
                        href="<a
                        href="http://linux-bangalore.org">http://linux-bangalore.org</a>"><a
                        href="http://linux-bangalore.org">http://linux-bangalore.org</a></a> for
                        more<BR>
                        information <BR><BR>
                        about us, as well as our other mailing lists<BR><BR>
                        <BR><BR>
                        Before you post to this list, please read<BR><BR>
                        <a<BR>
                        href="<a
                        href="http://linux-bangalore.org/articles/smart-questions.php">http://linux-
                        bangalore.org/articles/smart-questions.php</a>"><a
                        href="http://linux-">http://linux-</a><BR>
                        bangalore.org/articles/smart-questions.php</a><BR><BR>
                        </tt><BR>
                        <br><BR>
                        <BR>
                        <br><BR>
                        <tt>Your use of Yahoo! Groups is subject to the <a<BR>
                        href="<a
                        href="http://docs.yahoo.com/info/terms/">http://docs.yahoo.com/info/terms/</
                        a>">Yahoo! Terms of Service</a>.</tt><BR>
                        </br><BR>
                        <BR>
                        </body></html><BR>
                        <BR>
                        <BR>
                        --<BR>
                        ______________________________________________<BR>
                        <a href="http://www.linuxmail.org/">http://www.linuxmail.org/</a><BR>
                        Now with POP3/IMAP access for only US$19.95/yr<BR>
                        <BR>
                        Powered by Outblaze<BR>
                        <BR>
                        <BR>
                        <BR>
                        ---------------------------------------------------------------<BR>
                        This is the programming list of the Bangalore Linux Users Group<BR>
                        ---------------------------------------------------------------<BR>
                        Go to <a
                        href="http://linux-bangalore.org">http://linux-bangalore.org</a> for more
                        information<BR>
                        about us, as well as our other mailing lists<BR>
                        <BR>
                        Before you post to this list, please read<BR>
                        <a
                        href="http://linux-bangalore.org/articles/smart-questions.php">http://linux-
                        bangalore.org/articles/smart-questions.php</a><BR>
                        <BR>
                        <BR>
                        Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.<BR>
                        <BR>
                        <BR>
                        [Non-text portions of this message have been removed]<BR>
                        <BR>
                        <BR>
                        </tt>


                        <br>
                        <tt>
                        <BR>
                        ---------------------------------------------------------------<BR>
                        This is the programming list of the Bangalore Linux Users Group<BR>
                        ---------------------------------------------------------------<BR>
                        Go to <a
                        href="http://linux-bangalore.org">http://linux-bangalore.org</a> for more
                        information <BR>
                        about us, as well as our other mailing lists<BR>
                        <BR>
                        Before you post to this list, please read<BR>
                        <a
                        href="http://linux-bangalore.org/articles/smart-questions.php">http://linux-
                        bangalore.org/articles/smart-questions.php</a><BR>
                        </tt>
                        <br>

                        <br>
                        <tt>Your use of Yahoo! Groups is subject to the <a
                        href="http://docs.yahoo.com/info/terms/">Yahoo! Terms of Service</a>.</tt>
                        </br>

                        </body></html>


                        --
                        ______________________________________________
                        http://www.linuxmail.org/
                        Now with POP3/IMAP access for only US$19.95/yr

                        Powered by Outblaze



                        ---------------------------------------------------------------
                        This is the programming list of the Bangalore Linux Users Group
                        ---------------------------------------------------------------
                        Go to http://linux-bangalore.org for more information
                        about us, as well as our other mailing lists

                        Before you post to this list, please read
                        http://linux-bangalore.org/articles/smart-questions.php


                        Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


                        [Non-text portions of this message have been removed]
                      • Nikhil Kale
                        cat /proc/sys/net/ipv4/tcp_max_syn_backlog check out man page of tcp for more details Regards, Nikhil Kale [tons of unnecessarily quoted text removed by
                        Message 11 of 12 , Jan 10, 2003
                        • 0 Attachment
                          cat /proc/sys/net/ipv4/tcp_max_syn_backlog
                          check out man page of tcp for more details



                          Regards,
                          Nikhil Kale

                          [tons of unnecessarily quoted text removed by completely overworked listadmin, cursing all the way....]
                        • Kiran Kumar
                          Hi, The backlog in listen() call is different from this parameter (tcp_max_syn_backlog). This is from tcp(7) tcp_max_syn_backlog Length of the
                          Message 12 of 12 , Jan 10, 2003
                          • 0 Attachment
                            Hi,
                            The backlog in listen() call is different from this
                            parameter (tcp_max_syn_backlog). This is from tcp(7)
                            <tcp(7)>
                            tcp_max_syn_backlog
                            Length of the per-socket backlog
                            queue. "As of Linux 2.2, the backlog specified in
                            listen(2) only specifies the length of the backlog
                            queue of already established sockets.
                            The maximum queue of sockets not yet established (in
                            SYN_RECV state) per listen socket is set by this
                            sysctl." When more connection requests arrive, Linux
                            starts to drop packets.
                            </tcp(7)>
                            Further from listen(2)
                            <listen(2)>
                            The backlog parameter defines the maximum
                            length the queue of _pending_ connections may grow to.
                            </listen(2)>
                            Regards,
                            Kiran Kumar Immidi

                            --- Nikhil Kale <nikhilkale@...> wrote:
                            > cat /proc/sys/net/ipv4/tcp_max_syn_backlog
                            > check out man page of tcp for more details
                            >
                            >
                            >
                            > Regards,
                            > Nikhil Kale
                            >
                            > [tons of unnecessarily quoted text removed by
                            > completely overworked listadmin, cursing all the
                            > way....]
                            >
                            >

                            __________________________________________________
                            Do you Yahoo!?
                            Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
                            http://mailplus.yahoo.com
                          Your message has been successfully submitted and would be delivered to recipients shortly.