
Smart Winsock
=============
                                               LSS 5.0(0), August 1996
                                               -----------------------
Overview
--------

This  document  explains  the  Winsock  concept,  lists  the  software 
components  that  make  up  Madge  Network's  Smart  Winsock  product, 
explains why Smart Winsock may be of use to you and describes  how  to 
install the software.

The information contained in this document includes:

Section 1       The Winsock Concept
Section 2       The Madge Networks Smart Winsock product
Section 3       Who should use Smart Winsock
Section 4       How to install/de-install Smart Winsock
Section 5       A sample Winsock Application: WINPING.EXE
Section 6       Smart Winsock compatibility with the Winsock 1.1 
                specification
Section 7       Internet sites containing useful Winsock information


1 The Winsock Concept
---------------------

"Winsock"  is  the  familiar  term  for the Windows Sockets Interface, 
developed by a group of Networking companies and described as an "Open 
Interface for Network Programming under Microsoft Windows".

The idea behind Winsock is that an  end  user  whose  Network  Adapter 
Software  supports  the  Winsock  Interface  will  be  able to use any 
Winsock Compliant Application.  The  Winsock  concept  has  been  well 
received  and there are many Winsock compliant applications available.  
Many of the common applications such as TELNET and FTP  are  available 
as Shareware (see section 7 below).

The Madge Networks Winsock implements version 1.1 of the specification 
and  is  designed  to  be  used  with Microsoft Windows 3.0 and later.  
Although the Specification can in principle use any Network  Transport 
Protocol, it is really designed with the TCP/IP protcol suite in mind. 

Version  2.0  of  the Winsock specification has recently been released 
but as yet it appears unlikely that this will be widely  supported  in 
Windows 3.1 or 3.11.


2 The Madge Networks Smart Winsock Product
------------------------------------------

The  Madge  Networks  Smart  Winsock  Product  is based on v1.1 of the 
Winsock specification and on RFCs 1034 and 1035 which describe the DNS 
host name resolution protocol.  It works with  Microsoft  Windows  3.1 
and 3.11 running in Enhanced Mode.

Smart  Winsock  consists  of  two  Windows  programs,  WINSOCK.DLL and 
VNOVAPI.386, and uses Smart TCP/IP as it's TCP/IP stack.

This information file applies to the files listed below.

The Smart TCP/IP software: 
        
        SMART.EXE       v3.53 or later
        NOVAPI.SMT      v3.20 or later  
        TCP.SMT         v3.20 or later
        UDP.SMT         v3.20 or later
        IP.SMT          v3.20 or later

The Winsock software:

        WINSOCK.DLL     v1.05 or later
        VNOVAPI.386     v1.05 or later


3 Who should use Smart Winsock
------------------------------

Smart  Winsock  is  most likely to be of use to the following kinds of 
user:

 1 Those who currently have no TCP/IP networking software or
   applications installed.

   For  these  users,  Smart Winsock immediately provides an interface 
   which allows most commercial  TCP/IP  applications  to  run.   This 
   includes  X-Server  applications,  World  Wide Web browsers such as 
   Mosaic and  Netscape  and  standard  TCP/IP  applications  such  as 
   TELNET,  FTP  and  TALK. Good quality applications of this kind are 
   also available on the Internet as Shareware.
 
 2 Those who currently have TCP/IP networking software installed but
   are concerned about DOS memory utilization. 

   Smart Winsock will use less DOS memory than similar solutions using 
   NDIS or ODI with host resident TCP/IP Software.  For  these  users, 
   it may be worthwhile switching to Smart Winsock.
   
   If  you are switching from an existing Winsock interface be sure to 
   de-install  the  existing  Winsock  software.   This  will  usually 
   consist  of  a  WINSOCK.DLL  file  and  a  .386 file.  For example, 
   Novell's Winsock implementation consists of the  files  WINSOCK.DLL 
   and VTCPIP.386.

**********************************************************************
   Note
                                                                    
   If you  are  currently  using Novell's LAN Workplace with  Smart  
   TCP/IP you  are  unlikely  to want to install Smart  Winsock, as  
   LAN Workplace provides a Winsock implementation.                         
                                                                    
**********************************************************************       
                                                                            

4a How to install Smart Winsock using the Winsock Install Utility
-----------------------------------------------------------------

 1 Install the Smart TCP/IP software.  

   You  will  need  to  configure  at least one IP address, default IP 
   router and IP netmask.

   See the  User Documentation,  SMTTCPIP.TXT  and  SMTNOVAP.TXT   for
   details.

 2 Run Windows and then run  WSSETUP.EXE  from the  SMART directory in
   the release.

 3 You  must  add frequently accessed host names to the HOSTS file and 
   the name(s) of your name server(s) ( ie. DNS  server(s)  )  to  the 
   RESOLV.CFG  file.   You  can  specify up to three domains and three 
   name servers in RESOLV.CFG.  The IP address of  the  names  servers 
   must  be  specified  in  RESOLV.CFG--you  cannot  use  a  name. The 
   location of these files is specified by the path.tcp.cfg  parameter 
   in smart.cfg, which defaults to \NET\TCP.
 
 4 Reboot  your  machine,  run Smart TCP/IP and start Windows. Winsock  
   is  now  installed  and you may run Winsock Compliant Applications.


4b How to install Smart Winsock by hand
---------------------------------------

 1 Install the Smart TCP/IP software.  

   In particular you will need to configure an IP address, default  IP 
   router and IP netmask.

   See the  User Documentation,   SMTTCPIP.TXT  and  SMTNOVAP.TXT  for
   details.

 2 Choose a directory  which  will  contain  the  Winsock  files,  for 
   example  C:\WINDOWS.   Copy  VNOVAPI.386  and  WINSOCK.DLL from the 
   SMART\WINSOCK directory in the release to this directory.

 3 Make an entry in the [novapi] section of smart.cfg as follows:

   [novapi]
   Winsock.Interface=Madge ; Winsock is Madge rather than LanWorkPlace
   path.winsock=C:\WINDOWS ; location of VNOVAPI.386 and WINSOCK.DLL

 4 Copy  the configuration files HOSTS, RESOLV.CFG, PROTOCOL, NETWORKS 
   and  SERVICES  to  the  directory  specified  by  the  path.tcp.cfg 
   parameter  in the [novapi] section of smart.cfg.  The default value 
   for this path is \NET\TCP.  You should add frequently accessed host 
   names to the HOSTS file and the name(s) of your  name  server(s)  ( 
   ie.  DNS server(s) ) to the RESOLV.CFG file.  You can specify up to 
   three domains and three name servers in RESOLV.CFG.  The IP address 
   of the names servers must be specified  in  RESOLV.CFG--you  cannot 
   use a name.

 5 Reboot  your  machine,  run  Smart  TCP/IP  and start Windows. 
   Winsock  is  now  installed  and  you  may  run  Winsock  Compliant 
   Aplications.

***NOTE*************************************************************** 

   NOVAPI.SMT will expect VNOVAPI.386/WINSOCK.DLL to be located in
   one of the following places:

      a) the  directory  provided by the  path.winsock  parameter  in
         SMART.CFG  (*Recommended*).

      b) the BIN directory associated with the  TCP_CFG  parameter in
         either NET.CFG or  SMART.CFG  (BIN is in the directory above
         that specified), eg.

               TCP_CFG set to NETWORK\CONFIG
               Files should be in NETWORK\BIN

      c) the directory \NET\BIN.

**********************************************************************

  
4c How to uninstall Smart Winsock 
----------------------------------

Smart Winsock can be uninstalled by using the uninstall option in  the 
Winsock Install program.

You  can  also  uninstall  Winsock  by  deleting  the  VNOVAPI.386 and 
WINSOCK.DLL   files   and   commenting    out    or    removing    the 
"Winsock.Interface" and "path.winsock" lines from the [novapi] section 
of smart.cfg (see 4b, step 3 above). 


5 A sample Winsock Application: WINPING.EXE
-------------------------------------------

The   Windows   program,   WINPING.EXE,   is   a   Winsock   compliant 
implementation of the useful  "ping"  utility.   This  allows  you  to 
determine  whether  there is a node with a given IP address present on 
your Network.  It is included here so that you can verify that Winsock 
is correctly installed on your computer.

Below  is  a  brief  explanation  of  the   options   available   with 
WINPING.EXE:

 . The Lookup option will list any aliases of the specified node.
     
 . Any of the options BlockingPing, AsynchPing  ,  or  NonBlockingPing 
   will  allow you to ping a remote IP address.  Each of these options 
   uses the Winsock interface in a different  way,  but  achieves  the 
   same result.

 . Exit  will  exit  the  program  while About provides information on 
   WINPING.EXE.


6 Smart Winsock compatibility with the Winsock 1.1 Specification
----------------------------------------------------------------

This section contains technical information about the  Madge  Networks 
implementation  of  Winsock.   It  is  intended for developers who are 
writing Winsock applications and is not really of  interest  to  users 
who simply want to install Winsock and run Winsock applications.

This section explains the behaviour of Smart Winsock for complex calls 
like shutdown and closesocket and also identifies parts of the Winsock 
1.1  specification  which  are not implemented in Smart Winsock.  If a 
Winsock option is not specifically mentioned here you may assume  that 
it  is  implemented as per the specification.  The unimplemented parts 
of the specification are little used or relatively unimportant options 
of various kinds.

1 The following options for send, sendto, recv and recvfrom are
  unsupported:

  . MSG_PEEK is ignored on recv or recvfrom.
  . MSG_OOB is ignored on recv and recvfrom as SO_OOBINLINE
    is always TRUE.  Out of band data is always received inline--see 
    3 below.
  . MSG_DONTROUTE is ignored on send and sendto.
  . The WSAEMSGSIZE error on recv or  recvfrom is  unsupported.   This 
    means that  if a  received  datagram  is too large to fit into the 
    specified buffer and is truncated then no error is generated.

   When  MSG_OOB  is  set  on  a  call  to  send  on  a socket of type 
   SOCK_STREAM then that data will be sent with the urgent bit of  the 
   TCP  header  set. However, there can be only one outstanding buffer 
   of urgent data at a time, the urgent data  does  not  skip  to  the 
   front  of  the  send queue and if the remote's window is closed the 
   data is not sent.

3 The following options for ioctlsocket are unsupported:

  . using the SIOCATMARK will cause ioctlsocket to return TRUE
    meaning "no out-of-band data available".  Smart Winsock always
    receives out-of-band data in line--see 1 above.

4 The following notes refer to the handling of socket options:

  . The following socket options default to TRUE and can not be
    changed to FALSE:
    
    . SO_BROADCAST
    . SO_OOBINLINE

  . The following socket options default to FALSE and can not be
    changed to TRUE:

    . SO_DEBUG
    . SO_DONTROUTE

  . TCP_NODELAY is ignored for setsockopt and always returned as FALSE 
    in getsockopt though in fact the Nagle algorithm is NOT turned on.

  . Non-zero  timeout  values  in  the  l_onoff field of SO_LINGER are 
    ignored and the socket is closed in the normal, graceful  way.   A 
    zero  value  in the l_onoff field of SO_LINGER (ie. a hard close ) 
    is  supported  and  will  cause  all  outstanding  data  on   that 
    connection to be discarded and a TCP reset frame to be sent to the 
    remote. 

  . The  SO_RCVBUF  and  SO_SNDBUF  options  are  not  supported.  The 
    correct way to configure the send and receive  buffer  sizes  with 
    Smart TCP/IP is to use the frame.size parameter  (see SMTCARD.TXT) 
    and the  tcp.receive.buffers  and  tcp.transmit.buffers parameters 
    (see SMTTCPIP.TXT).

    The values actually  returned  by  these  socket  options  are  as 
    follows:

    SO_RCVBUF returns 1024 on setsockopt and 0 on getsockopt, it
    actually has no affect.  
    SO_SNDBUF returns the "transmit buffer" size for this socket,
    this is usually 2K but can be arbitrated down to 4K.
 
  . SO_ERROR is not supported and always returns 0.

  . All the following socket options return ENOPROTOPT:
  
        SO_SNDLOWAT     
        SO_RCVLOWAT     
        SO_SNDTIMEO     
        SO_RCVTIMEO     

5 The maximum number of sockets supported is 64.

6 You can create sockets of type SOCK_RAW using the socket
  function. The supported functions for raw sockets are:
  
  . socket
  . ioctlsocket to set non-blocking mode
  . sendto
  . recvfrom
  . closesocket

  Raw sockets are supported only for ping. The application is
  responsible for building and processing ICMP headers.

7 The following notes apply to the shutdown function:

  . Either  do  not  use  shutdown  at  all, or use shutdown only when 
    preparing to terminate communications (for example, to  close  the 
    socket--in  which  case  there is little advantage to be gained in 
    calling shutdown ).  Note that socket resources are  not  released 
    unitl the socket is properly closed using closesocket.

  . With  sockets  of  type  SOCK_DGRAM,  a call to shutdown for reads 
    means that subsequent calls to recv and recvfrom fail  and  return 
    WSAESHUTDOWN.   If  there  are  outstanding  recvs from before the 
    shutdown was issued then these  will  complete  normally  if  data 
    arrives.   Data  for  which there are no revcs pending is buffered 
    but cannot be received.
  
    Data can still be sent on the socket.

  . With sockets of type SOCK_DGRAM, a call to shutdown 
    for writes means that subsequent calls to send and sendto fail 
    and return WSAESHUTDOWN.
    Data can still be read from the socket.

  . With sockets of type SOCK_STREAM, a call  to  shutdown  for  reads 
    will  cause  a  reset  of  the TCP connection if there is any data 
    currently waiting to be received or if any further  data  arrives. 
    This  means  that  a  TCP  RST frame is sent to the remote and any 
    buffered or incoming data for that connection is lost.  Subsequent 
    calls to recv and recvfrom fail and return WSAESHUTDOWN.
    
    Data can still be sent on this socket until some data is
    received, causing the connection to be reset.

  . With sockets of type SOCK_STREAM, a call to shutdown for writes
    causes a TCP FIN frame to be sent to the remote.
    Subsequent calls to send and sendto fail and return WSAESHUTDOWN.
    
    Data can still be read from the socket.

8 The following notes apply to the closesocket function:

  . With sockets of type SOCK_DGRAM a closesocket call immediately
    frees the resources associated with that socket and any queued
    data (send or receive) is lost.
    The remote can continue to receive and send data.
    Further Winsock calls to that socket will result in a WSAENOTSOCK
    error.

  . With  sockets  of  type  SOCK_STREAM  a closesocket call frees the 
    socket resources at the Winsock level.  Further Winsock  calls  to 
    that socket will result in a WSAENOTSOCK error.  
    
    Note   however   that  in  the  case  of  a  graceful  close  (ie. 
    SO_DONTLINGER is set on the socket ) Smart TCP/IP will  hold  onto 
    socket  resources  until  the  remote  closes  it's  side  of  the 
    connection.  If SO_LINGER is set for a hard close then Smart  TCP/
    IP  will  reset the connection and free the socket resources after 
    an appropriate time delay.  See the  SO_LINGER  option  above  for 
    more information.


7 Internet sites containing useful Winsock information
------------------------------------------------------

http://www.stardust.com
http://www.intel.com



                  ****** End of WINSOCK.TXT ****** 
