Professional Documents
Culture Documents
S5958v2 PDF
S5958v2 PDF
Session 5958
Greg Granger
grgran@sas.com
What is Sockets
U An Application Programming Interface (API) used
for InterProcess Communications (IPC). [A well
defined method of connecting two processes,
locally or across a network]
U Protocol and Language Independent
U Often referred to as Berkeley Sockets or BSD
Sockets
Networking Terms
U packet - the smallest unit that can be transferred
through the network by itself
U protocol - a set of rules and conventions between
the communicating participants
U A collection of protocol layers is referred to as a
protocol suite, protocol family or protocol
stack. TCP/IP is one such protocol suite.
Introduction to TCP/IP
U What (the heck) is TCP/IP?
U Internet Protocol (IP)
U User Datagram Protocol (UDP)
U Transmission Control Protocol (TCP)
U TCP/IP Applications
U Name Resolution Processing
U TCP/IP Network Diagram
What is TCP/IP?
U Transmission Control Protocol/Internet Protocol
U A network protocol suite for interprocess
communication
U The protocol of the Internet
U Open, nonproprietary
U Integrated into UNIX operating systems
U Many popular networking applications
telnet NFS (network file system)
X11 GUI SMTP (mail)
www ftp (file transfer protocol)
Physical Network
TCP/UDP/IP Diagram
Dev1.sas.com
(149.179.3.3)
64K
TCP Ports
REXEC client
REXEC
Server
Dev2.sas.com
port 512
1023 (149.179.83.6)
Well-known Ports
0 IP Routing
0
Well-known Ports
1023 REXEC client
Server1.net.sas.com
(149.193.2.194)
Back to Sockets
U Socket Definition and Components
U Socket Library Functions
U Primary Socket Header Files
U Sample Client/Server Dialog
U Ancillary Socket Topics
U Beyond Sockets
socket()
Remote Client
bind() socket()
listen() gethostbyname()
accept() connect()
recv()/send() recv()/send()
close() close()
Design Considerations
U Data representation and conversion
U Server design alternatives
U Security Issues
U Portability Considerations
Data Representation
U Transport Protocols detail data exchange/movement;
applications must interpret the data!
U Byte order affects data - not just addresses
U Text is often sent in ASCII, but ASCII versus EBCDIC is
decided by the application-level protocol
U Structure alignment and floating point pose problems
U External Data Representation (XDR) can be used (even
without RPC)
Security Considerations
U Socket semantics do NOT address security problems, such
as:
IP and adapter addresses
Userid and passwords
data encryption
traces
U UNIX systems require root privilege when a program binds
a reserved (<1024) port
U getpeername() returns the peers port and IP-address:
determine privileged peers and trusted hosts
U The Kerberos protocol provides password and data
encryption, along with service authentication
Portability Considerations
U Limit applications to standard socket routines, BSD 4.x
U Implement a portable transport module
U Mainframe Environment - Distribute existing applications
API Programmers Reference - Details
SAS/C, C/370, Interlink, Open Connect, NSC
U OS/2 - REXX Sockets, Programmers Toolkit
U MS Windows Sockets 1.1 - 2 WINSOCK.DLL
(http://www.stardust.com ftp.stardust.com:/pub/winsock)
Summary
U Basic networking and features of TCP/IP protocols
U Socket library organization
U Socket library coding techniques
U Awareness of more advanced topics
Whats Next
U Session 5959 - Part II - Client/Server Application
Bibliography
U Internetworking with TCP/IP: Volumes I, II & III, Douglas
Comer, Prentice Hall, 1991 (ISBN Vol I: 0134685059, Vol
III: 0138487146)
U The Whole Internet Users Guide & Catalog by Ed Kroll;
OReilly & Associates
U UNIX Network Programming by W. Richard Stevens;
Prentice Hall, 1990 (ISBN 0139498761)
U Socket API Programmers Reference
U UNIX man pages
U TCP/IP Illustrated: Volumes 1 & 2, W. Richard Stevens (v2
with Gary R. Wright); Addison-Wesley Publishing Company,
1994