Professional Documents
Culture Documents
Upper Layers
Sockets;
protocols;
Database access
interchangeably.
Process – a program in execution; process execution
Spawn
Thread States
CNSM6114 – Network Programming
14
One or More Threads in Process
Each thread has
An execution state (running, ready, etc.)
Saved thread context when not running
An execution stack
Some per-thread static storage for local variables
Access to the memory and resources of its process (all threads of a process
share this)
One way to view a thread is as an independent program counter
operating within a process.
CNSM6114 – Network Programming
15
Benefits of Threads
Takes less time to create a new thread than a
process
Less time to terminate a thread than a process
ATM Services:
Constant/variable bit rate 34
Switching
35
Packet Switching:
No predefined paths, e.g. traditional LAN.
Circuit Switching:
Specific path set up for each connection, e.g. telephone networks.
ATM Switching:
Hybrid of packet and circuit switching.
Multiple connections over a predefined path.
ATM devices:
ATM Switches.
ATM endpoints, e.g. workstations, video
coders/decoders.
User-Network Interface (UNI) & Network-Node
Interface (NNI).
Message delivery:
At-least-once.
At-most-once.
Feedback:
End-to-end application-level acknowledgement.
Error report on failures.
Low end-to-end latency.
Support large request/response messages.
using feedback:
Acknowledgements, timeouts.
Communication protocols cannot be made completely
reliable:
Client cannot distinguish a server that went down from one
that has become disconnected.
CNSM6114 – Network Programming
Unresponsive Server
44
Request Request
Response
Session management:
Unique session identifier.
Guaranteed at-most-once message delivery.
End-to-end acknowledgement:
No dependence on protocol stack.
Positive feedback about delivery and response can only be provided by an end-to-
end application level acknowledgement.
Trick:
Create stub functions that make it appear to the user that the call is really
local.
A stub function looks like the function that the user intends to call but
really contains code for sending and receiving messages over a network.
2-8
51
Benefits
52
“transparently”.
CNSM6114 – Network Programming
Marshalling
55
Which one?
Some implementations may offer only one (e.g. TCP).
Most support several:
Allow programmer (or end user) to choose.
stubs:
Marshaling code
Unmarshaling code
Network transport routines
Conform to defined interface
Similar to function prototypes
CNSM6114 – Network Programming
Writing an RPC Program
59
Start server
Server stub creates a socket and binds any available local port to it.
Calls a function in the RPC library:
svc_register to register program#, port #
contacts portmapper (rpcbind on SVR4):
Name server
Keeps track of {program#,version#,protocol} port# bindings
Server then listens and waits to accept connections.
Internet integration
Security
Primary Components
Common Language Infrastructure (CLI): specifications for a runtime
environment, including a common type system, base class library, and a
machine-independent intermediate code known as the Common
Intermediate Language (CIL) – MSIL.
Common Language Runtime (CLR): Runtime environment to run any
CIL code that adheres to CLI specs usually through JIT compilation.
CNSM6114 – Network Programming
.NET Structure: CLR and Win32 Services
76
Win32
Provides WebForms for
thin clients, plus web
services via HTTP
CNSM6114 – Network Programming
.NET Framework: More generally
77
Client Server
Java Object
C++ Object
Skeleton
Stub Object Adapter
IIOP
ORB ORB
CNSM6114 – Network Programming
Stub
Provides interface between client object and ORB
Marshalling: client invocation
Client Server
Java Object
C++ Object
Skeleton
Stub Object Adapter
IIOP
ORB ORB
CNSM6114 – Network Programming 81
Skeleton
Provides iterface between server object and ORB
Unmarshaling: client invocation
Client Server
Java Object
C++ Object
Skeleton
Stub Object Adapter
IIOP
ORB ORB
CNSM6114 – Network Programming 82
(Portable) Object Adapter (POA)
Register class implementations
Creates and destroys objects
Client Server
Java Object
C++ Object
Skeleton
Stub Object Adapter
IIOP
ORB ORB
CNSM6114 – Network Programming 83
Object Request Broker (ORB)
Communication infrastructure sending messages between objects
Communication type:
GIOP (General Inter-ORB Protocol)
IIOP (Internet Inter-ORB Protocol) (GIOP on TCP/IP)
Client Server
Java Object
C++ Object
Skeleton
Stub Object Adapter
IIOP
ORB ORB
CNSM6114 – Network Programming 84
Example of CORBA Services
85