Standard network method

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

    #1

    Standard network method

    Hi
    I'd like a way of communicating over a network that doesn't rely on
    vendor-specific libraries, preferably that will work on both windows and
    linux (the ideal solution would be one that compiles on windows and linux,
    but the absolute ideal one would be one that also enables windows to
    communicate *with* linux in realtime, but that's a pipe dream as yet...)
    Nothing too fancy, the amounts of data won't be great. Just open a
    connection on a specific port, send some data down it, close. And receive
    from the other end.

    i.e. is there a standard library function for it...? I'm thinking along the
    lines of fopen(), fread(), ..... , is there an f_tcp() ?

    Can be either in C or C++.


  • Florian Quetting

    #2
    Re: Standard network method

    use (TCP-)sockets.

    Bonj wrote:
    [color=blue]
    > Hi
    > I'd like a way of communicating over a network that doesn't rely on
    > vendor-specific libraries, preferably that will work on both windows and
    > linux (the ideal solution would be one that compiles on windows and linux,
    > but the absolute ideal one would be one that also enables windows to
    > communicate *with* linux in realtime, but that's a pipe dream as yet...)
    > Nothing too fancy, the amounts of data won't be great. Just open a
    > connection on a specific port, send some data down it, close. And receive
    > from the other end.
    >
    > i.e. is there a standard library function for it...? I'm thinking along
    > the lines of fopen(), fread(), ..... , is there an f_tcp() ?
    >
    > Can be either in C or C++.[/color]

    Comment

    • Flash Gordon

      #3
      Re: Standard network method

      Bonj wrote:[color=blue]
      > Hi
      > I'd like a way of communicating over a network that doesn't rely on
      > vendor-specific libraries,[/color]

      Then you have a problem.
      [color=blue]
      > preferably that will work on both windows and
      > linux (the ideal solution would be one that compiles on windows and linux,
      > but the absolute ideal one would be one that also enables windows to
      > communicate *with* linux in realtime, but that's a pipe dream as yet...)
      > Nothing too fancy, the amounts of data won't be great. Just open a
      > connection on a specific port, send some data down it, close. And receive
      > from the other end.
      >
      > i.e. is there a standard library function for it...? I'm thinking along the
      > lines of fopen(), fread(), ..... , is there an f_tcp() ?
      >
      > Can be either in C or C++.[/color]

      Nothing like that exists in C. You either need to find a third party
      library ported to all the systems you are interested in or write your own.

      <OT>
      There is a lot of commonality between Windows and *nix, since MS based
      their TCP/IP library on BSD Sockets. So writing some thin wrappers is
      not that difficult. However, how you do networking is not on topic here,
      so ask for details in networking and/or system specific groups.
      </OT>

      Any C++ answers are off topic in comp.lang.c, so please take it off if
      posting a C++ answer.
      --
      Flash Gordon
      Living in interesting times.
      Although my email address says spam, it is real and I read it.

      Comment

      • Dave O'Hearn

        #4
        Re: Standard network method

        Bonj wrote:[color=blue]
        > i.e. is there a standard library function for it...? I'm thinking[/color]
        along[color=blue]
        > the lines of fopen(), fread(), ..... , is there an f_tcp() ?
        >
        > Can be either in C or C++.[/color]

        There is no standard library support for sockets in either C or C++.
        Boost does not support sockets yet either.

        There are some sockets libraries that claim to be portable to many
        platforms, but they are not standard.

        --
        Dave O'Hearn

        Comment

        • Emmanuel Delahaye

          #5
          Re: Standard network method

          Bonj wrote on 31/12/04 :[color=blue]
          > I'd like a way of communicating over a network that doesn't rely on[/color]

          You are completely off-topic ont both newsgroups.
          [color=blue]
          > vendor-specific libraries,[/color]

          Write your own.
          [color=blue]
          > preferably that will work on both windows and
          > linux (the ideal solution would be one that compiles on windows and linux,[/color]

          BSD Sockets and Winsock2 are very similar.
          [color=blue]
          > but the absolute ideal one would be one that also enables windows to
          > communicate *with* linux in realtime, but that's a pipe dream as yet...)[/color]

          There is no reason for a network (IP, for example) not to support
          mac+linux+windo ws or anyelse servers/clients... Zillions of working
          solutions are running around the world probably for a 10th of years...
          [color=blue]
          > Nothing too fancy, the amounts of data won't be great. Just open a connection
          > on a specific port, send some data down it, close. And receive from the other
          > end.
          >
          > i.e. is there a standard library function for it...? I'm thinking along the
          > lines of fopen(), fread(), ..... , is there an f_tcp() ?[/color]

          No. I think there is a kind of a portable wrapper for networking, but I
          can't recall the name. Search the net. Google is your friend.

          --
          Emmanuel
          The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
          The C-library: http://www.dinkumware.com/refxc.html

          "Clearly your code does not meet the original spec."
          "You are sentenced to 30 lashes with a wet noodle."
          -- Jerry Coffin in a.l.c.c++

          Comment

          • Joona I Palaste

            #6
            Re: Standard network method

            Florian Quetting <quetting@email .de> scribbled the following
            on comp.lang.c:[color=blue]
            > Bonj wrote:[/color]
            [color=blue][color=green]
            >> Hi
            >> I'd like a way of communicating over a network that doesn't rely on
            >> vendor-specific libraries, preferably that will work on both windows and
            >> linux (the ideal solution would be one that compiles on windows and linux,
            >> but the absolute ideal one would be one that also enables windows to
            >> communicate *with* linux in realtime, but that's a pipe dream as yet...)
            >> Nothing too fancy, the amounts of data won't be great. Just open a
            >> connection on a specific port, send some data down it, close. And receive
            >> from the other end.
            >>
            >> i.e. is there a standard library function for it...? I'm thinking along
            >> the lines of fopen(), fread(), ..... , is there an f_tcp() ?
            >>
            >> Can be either in C or C++.[/color][/color]
            [color=blue]
            > use (TCP-)sockets.[/color]

            As the OP seems to have been asking how to use TCP-sockets, your answer
            is kind of circular.
            Anyway, the C language has no support for any sort of networking
            whatsoever, TCP-sockets or otherwise. Actually C predates TCP by quite
            many years.
            Please don't give off-topic answers on comp.lang.c.

            --
            /-- Joona Palaste (palaste@cc.hel sinki.fi) ------------- Finland --------\
            \-------------------------------------------------------- rules! --------/
            "We sorcerers don't like to eat our words, so to say."
            - Sparrowhawk

            Comment

            • Kenny McCormack

              #7
              Re: Standard network method

              In article <1104514223.592 280.134570@c13g 2000cwb.googleg roups.com>,
              Dave O'Hearn <daveoh77@pobox .com> wrote:[color=blue]
              >Bonj wrote:[color=green]
              >> i.e. is there a standard library function for it...? I'm thinking
              >>along the lines of fopen(), fread(), ..... , is there an f_tcp() ?
              >>
              >> Can be either in C or C++.[/color]
              >
              >There is no standard library support for sockets in either C or C++.
              >Boost does not support sockets yet either.[/color]

              What is "Boost" ?

              Comment

              • Emmanuel Delahaye

                #8
                Re: Standard network method

                Kenny McCormack wrote on 31/12/04 :[color=blue]
                > What is "Boost" ?[/color]

                A C++ thing...

                --
                Emmanuel
                The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
                The C-library: http://www.dinkumware.com/refxc.html

                "C is a sharp tool"

                Comment

                • adbarnet

                  #9
                  Re: Standard network method

                  The past inherited, the future encapsulated.

                  "Kenny McCormack" <gazelle@yin.in teraccess.com> wrote in message
                  news:cr48v0$7uu $1@yin.interacc ess.com...[color=blue]
                  > In article <1104514223.592 280.134570@c13g 2000cwb.googleg roups.com>,
                  > Dave O'Hearn <daveoh77@pobox .com> wrote:[color=green]
                  >>Bonj wrote:[color=darkred]
                  >>> i.e. is there a standard library function for it...? I'm thinking
                  >>>along the lines of fopen(), fread(), ..... , is there an f_tcp() ?
                  >>>
                  >>> Can be either in C or C++.[/color]
                  >>
                  >>There is no standard library support for sockets in either C or C++.
                  >>Boost does not support sockets yet either.[/color]
                  >
                  > What is "Boost" ?
                  >[/color]


                  Comment

                  • Mike Wahler

                    #10
                    Re: Standard network method

                    "Kenny McCormack" <gazelle@yin.in teraccess.com> wrote in message
                    news:cr48v0$7uu $1@yin.interacc ess.com...[color=blue]
                    > In article <1104514223.592 280.134570@c13g 2000cwb.googleg roups.com>,
                    > Dave O'Hearn <daveoh77@pobox .com> wrote:[color=green]
                    > >Bonj wrote:[color=darkred]
                    > >> i.e. is there a standard library function for it...? I'm thinking
                    > >>along the lines of fopen(), fread(), ..... , is there an f_tcp() ?
                    > >>
                    > >> Can be either in C or C++.[/color]
                    > >
                    > >There is no standard library support for sockets in either C or C++.
                    > >Boost does not support sockets yet either.[/color]
                    >
                    > What is "Boost" ?[/color]

                    It's a library of utilities for C++, much of which
                    is slated to be included in the next revision of
                    the standard.

                    See www.boost.org

                    -Mike


                    Comment

                    • adbarnet

                      #11
                      Re: Standard network method

                      BTW please do not top-post

                      AD ;-)

                      "Mike Wahler" <mkwahler@mkwah ler.net> wrote in message
                      news:Q3jBd.1361 8$RH4.525@newsr ead1.news.pas.e arthlink.net...[color=blue]
                      > "Kenny McCormack" <gazelle@yin.in teraccess.com> wrote in message
                      > news:cr48v0$7uu $1@yin.interacc ess.com...[color=green]
                      >> In article <1104514223.592 280.134570@c13g 2000cwb.googleg roups.com>,
                      >> Dave O'Hearn <daveoh77@pobox .com> wrote:[color=darkred]
                      >> >Bonj wrote:
                      >> >> i.e. is there a standard library function for it...? I'm thinking
                      >> >>along the lines of fopen(), fread(), ..... , is there an f_tcp() ?
                      >> >>
                      >> >> Can be either in C or C++.
                      >> >
                      >> >There is no standard library support for sockets in either C or C++.
                      >> >Boost does not support sockets yet either.[/color]
                      >>
                      >> What is "Boost" ?[/color]
                      >
                      > It's a library of utilities for C++, much of which
                      > is slated to be included in the next revision of
                      > the standard.
                      >
                      > See www.boost.org
                      >
                      > -Mike
                      >
                      >[/color]


                      Comment

                      • kan Pu

                        #12
                        Re: Standard network method

                        I am not sure what you mean. But a TCP/IP protocol can meet your
                        requirement. And by the way, I think a open source library "ACE" ( Adaptive
                        communication envirement), which can be found in www.cs.wustl.edu/~schmidt/
                        , can be used directly.

                        "Bonj" <a@b.com> дÈëÓʼþ news:33ldpoF3u7 dn5U1@individua l.net...[color=blue]
                        > Hi
                        > I'd like a way of communicating over a network that doesn't rely on
                        > vendor-specific libraries, preferably that will work on both windows and
                        > linux (the ideal solution would be one that compiles on windows and linux,
                        > but the absolute ideal one would be one that also enables windows to
                        > communicate *with* linux in realtime, but that's a pipe dream as yet...)
                        > Nothing too fancy, the amounts of data won't be great. Just open a
                        > connection on a specific port, send some data down it, close. And receive
                        > from the other end.
                        >
                        > i.e. is there a standard library function for it...? I'm thinking along[/color]
                        the[color=blue]
                        > lines of fopen(), fread(), ..... , is there an f_tcp() ?
                        >
                        > Can be either in C or C++.
                        >
                        >[/color]


                        Comment

                        • Bonj

                          #13
                          Re: Standard network method

                          >> use (TCP-)sockets.[color=blue]
                          >
                          > As the OP seems to have been asking how to use TCP-sockets, your answer
                          > is kind of circular.[/color]

                          Thanks, this is precisely correct.
                          [color=blue]
                          > Anyway, the C language has no support for any sort of networking
                          > whatsoever, TCP-sockets or otherwise. Actually C predates TCP by quite
                          > many years.[/color]

                          I'm not bothered about whether it's actually defined as part of the C
                          standard. As long as it's "standard enough" to work on windows and linux.


                          Comment

                          • Bonj

                            #14
                            Re: Standard network method


                            "Emmanuel Delahaye" <emdel@YOURBRAn oos.fr> wrote in message
                            news:mn.fc9e7d4 c74d67530.15512 @YOURBRAnoos.fr ...[color=blue]
                            > Bonj wrote on 31/12/04 :[color=green]
                            >> I'd like a way of communicating over a network that doesn't rely on[/color]
                            >
                            > You are completely off-topic ont both newsgroups.[/color]

                            So what's the correct newsgroup to post requesting something in C, that
                            works on windows and linux then?
                            [color=blue]
                            > Write your own.[/color]

                            Where do I start?


                            Comment

                            • Gernot Frisch

                              #15
                              Re: Standard network method


                              "Bonj" <a@b.com> schrieb im Newsbeitrag
                              news:33ldpoF3u7 dn5U1@individua l.net...[color=blue]
                              > Hi
                              > I'd like a way of communicating over a network that doesn't rely on
                              > vendor-specific libraries, preferably that will work on both windows
                              > and linux (the ideal solution would be one that compiles on windows
                              > and linux, but the absolute ideal one would be one that also enables
                              > windows to communicate *with* linux in realtime, but that's a pipe
                              > dream as yet...)
                              > Nothing too fancy, the amounts of data won't be great. Just open a
                              > connection on a specific port, send some data down it, close. And
                              > receive from the other end.
                              >
                              > i.e. is there a standard library function for it...? I'm thinking
                              > along the lines of fopen(), fread(), ..... , is there an f_tcp() ?
                              >
                              > Can be either in C or C++.[/color]

                              You can download the source code for HawkNL - a cross platform
                              networking library - based on socks:

                              I think it's very good, though it's not maintained much anymore I
                              think.

                              also, from Alex Vinokur:
                              C++ Stram Compatible TCP/IP Sockets:
                              http://sourceforge.net/projects/cpp-sockets/


                              HTH,
                              Gernot


                              Comment

                              Working...