From: wade@nb.rockwell.com (Wade Guthrie)
Newsgroups: comp.unix.programmer
Subject: Re: Sockets vs. TLI (Summary)
Date: 23 Jul 92 21:24:55 GMT
Article-I.D.: nb.1992Jul23.212455.7993
Organization: Rockwell International




Originally, I asked:
 >the [Sun] documentation (Sun) says "Don't use sockets, you idiot, use TLI".
 >Why, and what's the difference?

Thanks to the following people (and, if there are others that I missed, I'm
sorry):

	ables@hal.com			(King Ables)
	kucharsk@anthrax.Solbourne.COM	(William Kucharski)
	lebrun@ll.mit.edu		(Steven F. LeBrun)
	barmar@think.com		(Barry Margolin)
	melennec@stna7.stna7.stna.dgac.fr (Ronan Melennec STNA 7S p8240 BD22)
	harry@wsl.ie			(Harry Moreau)
	lypr@is-triton.gwl.com		(Lyn Price)
	rstevens@noao.edu		(W. Richard Stevens)
	john@jwt.UUCP			(John Temples)

I got the following responses (in summary):

Universally, the consensus was to get W. Richard Stevens' book "UNIX
Network Programming" which contains excellent descriptions of both
socket and TLI programming.  I bought the book ($51, ouch), and it *IS*
excellent.

Technically there is very little difference as far as performance or
anything like that.  As regards reliability, there isn't much
difference.  The main difference is in reference to support and
portability; socket support has been slipping for years and TLI is the
new and "accepted" way of doing things.  However, in the POSIX 1003.12
draft they claim that a survey they took showed equal usage of sockets
and TLI, hence they're supporting both.  Yet in survey after survey
(informal) that [one responder to the above question] takes when he
teaches network programming classes, he continually finds 95% of the
people use sockets, 5% use TLI, and half of the 5% are AT&T employees
who don't have a choice.

There is also a question of the number of types of networks supported
by each.  Some say that sockets provides a more limited set of network
types; others disagree.


-----------------------------
Right now:

One good reason for sockets is that it is available on more computers.
There are many operating systems that support sockets and not TLI and
there are some operating systems that support both.  On Suns (see below),
there is an issue of quality of implementation as well.

-----------------------------
In the future:

The TLI is today considered the "standard" interface for networking.
If you write for sockets now, your code will be unportable in a short
time.  If you write in TLI, you have a good chance of porting it
later.

-----------------------------
In the "It's all in the implementation" department:

In SunOS 4.x sockets should be slightly more efficient than TLI, since
the kernel implements those operations directly, while TLI is a library
layered on top of these system calls.

In System V, however, sockets are a library layered on top of TLI.

On SUN computers, [TLI is implemented in terms of sockets] In the new
SunOS, it is TLI that is implemented at the kernal level and sockets
are implemented using TLI.  I am not sure at what point in the SUN
operating system, this switch was or is suppost to take place.  I
believe that I obtained this information from one of the USENET
newsgroups when the question arose about the statement in the SUN
manuals that state that you should use TLI instead of sockets.

-----------------------------
On SUNS (My particular problem):

SEVERAL PEOPLE SAID THE FOLLOWING: Sun admitted that that clause of the
documentation was a MISTAKE and you should ignore it.

Under SunOS 4.1.x TLI is a hack at best.  Going TLI now will be nothing
but a source of headaches and will cause you to wonder why your Sun
panics on seemingly innocuous TLI code.

[One person found...] Under [Sun OS] 4.1.1, there is no way to cleanly
terminate a connection if you can't tell when transmission is complete
(something our application had no way of doing). Sun eventually sent me
a jumbo patch which does not fix the problem - here's the README
section on this bug:

BUGID:1037715
        TCPTLI mistakely indicated ISO orderly release is supported,
        but actually, it is not. The fix now prompts the error
        of "feature not supported".

-----------------------------
What I did:

Well, since I was starting with a Sun, I decided that (no matter what
other issues were involved) since there is a reliability problem with
TLI on that platform, I'd use sockets.  One neat thing about sockets is
that quite a bit of existing code exists (and is being posted to the
net).  I used this to get me started.

Thanks again to everyone who responded.

--
Wade Guthrie
wade@nb.rockwell.com