[comp.lang.c++] TCP/IP in C++?

rchen@m.cs.uiuc.edu (02/11/89)

Does anyone have implemented TCP/IP in C++?  After a few weeks of working
on building C++ modules for NetBIOS, I would imagine a C++ TCP/IP module
would be simply beautiful for our project.  Any help would be appreciated.

-Ron Chen @ University of Illinois at Urbana-Champaign

ekrell@hector.UUCP (Eduardo Krell) (02/13/89)

In article <4800053@m.cs.uiuc.edu> rchen@m.cs.uiuc.edu writes:

>Does anyone have implemented TCP/IP in C++?  After a few weeks of working
>on building C++ modules for NetBIOS, I would imagine a C++ TCP/IP module
>would be simply beautiful for our project.  Any help would be appreciated.

What does TCP/IP in C++ mean? The TCP/IP drivers are part of the kernel
in BSD systems and are written in C. socket() et. al. are system calls
and you can call them from a C++ program provided you have the right
function definitions in your system C++ header files.
    
Eduardo Krell                   AT&T Bell Laboratories, Murray Hill, NJ

UUCP: {att,decvax,ucbvax}!ulysses!ekrell  Internet: ekrell@ulysses.att.com

rchen@m.cs.uiuc.edu (02/13/89)

/* Written 10:19 am  Feb 12, 1989 by ekrell@hector.UUCP in comp.lang.c++ */
>>In article <4800053@m.cs.uiuc.edu> rchen@m.cs.uiuc.edu writes:
>>
>>Does anyone have implemented TCP/IP in C++?  After a few weeks of working
>>on building C++ modules for NetBIOS, I would imagine a C++ TCP/IP module
>>would be simply beautiful for our project.  Any help would be appreciated.

>What does TCP/IP in C++ mean? The TCP/IP drivers are part of the kernel
>in BSD systems and are written in C. socket() et. al. are system calls
>and you can call them from a C++ program provided you have the right
>function definitions in your system C++ header files.
>    
>Eduardo Krell                   AT&T Bell Laboratories, Murray Hill, NJ

TCP/IP is not limited to BSD 4.2 UNIX any more.  Many parties are working on
porting it to all kinds of systems, such as IBM/PC networks.  One problem
with porting is that the c implementation of TCP/IP is messy, hard to
understand and modify.  With C++, one can define the network interfaces the
way he likes, i.g. one may have a IP class, UDP class as well as TCP class.
A user program can, in turn, define its own interface to the TCP/IP module,
say instead of socket one can define stream.  It is not that existing c
version of TCP/IP doesn't work, it's just not as neat as it should be.

-Ron Chen

bdale@hp-col.HP.COM (Bdale Garbee) (02/16/89)

Since C++ is by definition a superset of C, it would seem obvious that any
TCP/IP implementation already extant in C would fit the bill nicely.  The
KA9Q implemenation comes to mind...

Unless it's purely for academic interest, re-implementing this stuff to take
advantage of C++'ish features seems a colossal waste of time...

Bdale

rminnich@super.ORG (Ronald G Minnich) (02/18/89)

In article <1200001@hp-col.HP.COM> bdale@hp-col.HP.COM (Bdale Garbee) writes:
>Unless it's purely for academic interest, re-implementing this stuff to take
>advantage of C++'ish features seems a colossal waste of time...
I am not so sure. Think of all the hton stuff that it seems to me would 
go away. One recent version of tcp/ip source that got distributed was
missing some of these and did not work on some machines. 
Seems a lot of ugly fluff could disappear...I could trust the source more.
ron

rchen@m.cs.uiuc.edu (02/18/89)

/* Written  6:02 pm  Feb 15, 1989 by bdale@hp-col.HP.COM in comp.lang.c++ */

> Unless it's purely for academic interest, re-implementing this stuff to take
> advantage of C++'ish features seems a colossal waste of time...

The layered network paradigm (ISO or TCP/IP), however, is a good example
of showing off the beauty of C++ (too bad it's not written that way).

Actually, I was looking for some kind of universally acceptable C++
interface of TCP/IP.  The one I am using now (purely out of personal taste)
is like following,

foo() {
    // ...
    TCP_socket A("remote_task");  // open a direct link to a remote process
    UDP_socket B("p1", "p2");     // set up a conference with p1 and p2
    // ...
    A.send(buffer, buffer_size);  // throw at "her_task" (from "my_task")
    // ...
    date_size = B.recv(buffer2, buffer2_size);  // from either "p1" or "p2"
    // ...
}

class TCP_socket {
    // ...
    TCP_socket(const char * partner_name);
    // ...
}

class UDP_socket {
    // ...
    UDP_socket(const char * partner_name1, ...);
    // ...
}


-Ron Chen @ Department of Computer Science
            University of Illinois at Urbana-Champaign

henry@utzoo.uucp (Henry Spencer) (02/22/89)

In article <4800055@m.cs.uiuc.edu> rchen@m.cs.uiuc.edu writes:
>Actually, I was looking for some kind of universally acceptable C++
>interface of TCP/IP...

Since there is no universally-agreed interface to TCP/IP in any language,
you're not likely to find it...
-- 
The Earth is our mother;       |     Henry Spencer at U of Toronto Zoology
our nine months are up.        | uunet!attcan!utzoo!henry henry@zoo.toronto.edu

bdale@hp-col.HP.COM (Bdale Garbee) (02/22/89)

>Seems a lot of ugly fluff could disappear...I could trust the source more.

Ok.  Given equal amounts of effort to develop and test each implemenation, I
agree that it'd be easier to understand, and therefore trust, a C++ 
implementation.  My comments were directed from an environment in which I have
a couple of well-wrung-out TCP/IP implementations that I understand to base
future code on, and starting over just for the sake of a language would not 
provide a reasonable return on investment...

Layered protocols *do* make neat examples though... hadn't thought about that
until this discussion...

Bdale