c++ socket library

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mthread

    #1

    c++ socket library



    Hi,
    I am planning to write a TCP/IP server. I would like to know if
    any socket library is available for c++ or I have to use the socket
    function calls in C.

  • woolgate

    #2
    Re: c++ socket library

    ACE

    "mthread" <rjkumr@gmail.c omwrote in message
    news:865f4253-8db3-4816-8f38-b9eeaca752ea@t1 g2000pra.google groups.com...
    >
    >
    Hi,
    I am planning to write a TCP/IP server. I would like to know if
    any socket library is available for c++ or I have to use the socket
    function calls in C.
    >

    Comment

    • Michael DOUBEZ

      #3
      Re: c++ socket library

      mthread a écrit :
      >
      Hi,
      I am planning to write a TCP/IP server. I would like to know if
      any socket library is available for c++ or I have to use the socket
      function calls in C.
      >
      There is no standard socket library in C++. You can google for
      standalone library or you can use a framework like: ACE, Poco, gtk+ ...

      Michael

      Comment

      • Boris

        #4
        Re: c++ socket library

        On Wed, 12 Dec 2007 12:26:22 +0200, mthread <rjkumr@gmail.c omwrote:
        Hi,
        I am planning to write a TCP/IP server. I would like to know if
        any socket library is available for c++ or I have to use the socket
        function calls in C.
        Boost.Asio (see http://asio.sourceforge.net/; not yet part of the Boost
        distribution although it has been accepted to Boost already).

        Boris

        Comment

        • Ralf Globisch

          #5
          Re: c++ socket library

          On Dec 12, 12:26 pm, mthread <rjk...@gmail.c omwrote:
          Hi,
          I am planning to write a TCP/IP server. I would like to know if
          any socket library is available for c++ or I have to use the socket
          function calls in C.
          Besides Ace, QT also offers networking classes which are very easy to
          use, you'd have to check out their licensing model though...

          Comment

          • Default User

            #6
            Re: c++ socket library

            mthread wrote:
            >
            >
            Hi,
            I am planning to write a TCP/IP server. I would like to know if
            any socket library is available for c++ or I have to use the socket
            function calls in C.
            People have pointed out that there are no socket facilities in C++.
            There also are none in C either. It's all platforms-specific stuff.





            Brian

            Comment

            • Tomás Ó hÉilidhe

              #7
              Re: c++ socket library

              "Default User" <defaultuserbr@ yahoo.comwrote in news:5saulbF180 f6cU1
              @mid.individual .net:
              People have pointed out that there are no socket facilities in C++.
              There also are none in C either. It's all platforms-specific stuff.

              Never heard of cross-platform libraries?

              --
              Tomás Ó hÉilidhe

              Comment

              • Default User

                #8
                Re: c++ socket library

                Tomas S hIilidhe wrote:
                "Default User" <defaultuserbr@ yahoo.comwrote in news:5saulbF180 f6cU1
                @mid.individual .net:
                >
                People have pointed out that there are no socket facilities in C++.
                There also are none in C either. It's all platforms-specific stuff.
                >
                >
                Never heard of cross-platform libraries?
                *plonk*



                Brian

                Comment

                • mthread

                  #9
                  Re: c++ socket library

                  On Dec 13, 3:31 am, "Default User" <defaultuse...@ yahoo.comwrote:
                  Tomas S hIilidhe wrote:
                  "Default User" <defaultuse...@ yahoo.comwrote in news:5saulbF180 f6cU1
                  @mid.individual .net:
                  >
                  People have pointed out that there are no socket facilities in C++.
                  There also are none in C either. It's all platforms-specific stuff.
                  >
                  Never heard of cross-platform libraries?
                  >
                  *plonk*
                  >
                  Brian
                  Hi,

                  thanx everyone for the help

                  Comment

                  • Default User

                    #10
                    Re: c++ socket library

                    mthread wrote:
                    On Dec 13, 3:31 am, "Default User" <defaultuse...@ yahoo.comwrote:
                    Tomas S hIilidhe wrote:
                    "Default User" <defaultuse...@ yahoo.comwrote in
                    news:5saulbF180 f6cU1 @mid.individual .net:
                    People have pointed out that there are no socket facilities in
                    C++. There also are none in C either. It's all
                    platforms-specific stuff.
                    Never heard of cross-platform libraries?
                    plonk
                    thanx everyone for the help
                    Sure, let me know if there's anyone else I can plonk for you.





                    Brian

                    Comment

                    • Andrea Venturoli

                      #11
                      Re: c++ socket library

                      mthread ha scritto:
                      >
                      Hi,
                      I am planning to write a TCP/IP server. I would like to know if
                      any socket library is available for c++ or I have to use the socket
                      function calls in C.
                      >
                      I'm using: http://www.alhem.net/Sockets/
                      It has some glitches, but I choosed it for its light weight.

                      bye
                      av.

                      Comment

                      • Peter

                        #12
                        Re: c++ socket library

                        On Dec 12, 2:26 am, mthread <rjk...@gmail.c omwrote:
                        Hi,
                        I am planning to write a TCP/IP server. I would like to know if
                        any socket library is available for c++ or I have to use the socket
                        function calls in C.

                        First understand the socket library -- how to use it in C to write
                        your TCP/IP server.
                        Then recognize that there are pairs of function calls like e.g. socket/
                        close. accept/close.
                        Such pairs create classes with the do-action in the constructor and
                        the undo action in the destructor. I call such classes resource-
                        wrappers.
                        The constructor should throw something derived from std::exception in
                        case of the call fails.
                        The object thrown should contain every error information provided by
                        the system:
                        e.g. errno and the name of the function call which failed and maybe
                        some user supplied string which explains what has been attempted to
                        do.
                        From the saved errno you get the system error string via strerror.
                        IN the constructor create a std::string which contains the final error
                        message the user will see.
                        The what() method of the exception class will return what is returned
                        from the std::string.c_s tr().
                        Then recognize that there are functions which can also fail but do not
                        create a resource, like e.g. read/write. These belong into what I call
                        functional-wrappers.
                        A function returning void and calling the function to be wrapped.
                        If the function to be wrapped fails, again throw something containing
                        all the error information.
                        Finally you can write your TCP/IP server using these wrappers. You
                        will have to write a single try-catch block to deal with errors. The
                        code you're writing using these wrappers does not deal with errors
                        anymore.

                        Comment

                        Working...