Ethernet broadband or baseband signalling Hub and repeaters - - PDF document

ethernet
SMART_READER_LITE
LIVE PREVIEW

Ethernet broadband or baseband signalling Hub and repeaters - - PDF document

Ethernet broadband or baseband signalling Hub and repeaters Ethernet switches and bridges: Ethernet packets Ethernet topologies Bus, star, tree. Carrier-Sense Multiple Access with Collision Detection (CSMA/CD) All nodes


slide-1
SLIDE 1

1

1

Ethernet

broadband or baseband signalling Hub and repeaters Ethernet switches and bridges: Ethernet

packets

Ethernet topologies

Bus, star, tree.

Carrier-Sense Multiple Access with

Collision Detection (CSMA/CD)

All nodes are continuously ‘listening’ to the

medium for packets that are addressed to them.

Packets frames

Prefix: hardware timing purposes the destination address, the sending address; length of data (46—1,500 bytes), data of

variable length,

checksum

slide-2
SLIDE 2

2

2

Ethernet

Packet collision

carrier sensing: not enough Collision detection

  • Sender’s responsibility to detect

Minimum packet length in collision detection Send jamming signal, delay and try again Delay time is selected using binary exponential

back-off

A B A B

Message almost there at time T when B starts – collision!

time = 0 time = T’ time = 2T

A B

slide-3
SLIDE 3

3

3

Middleware

Application programming interfaces (APIs) Examples of middleware services

Remote data access (RDA) -- SQL access to

server-based DBMS.

Remote procedure calls (RPC) Remote method invocation (RMI)

Today’s topics

Interprocess communication (IPC); Java API for Internet transport protocols External data representation and marshalling

Applications, services Middleware layers request-reply protocol marshalling and external data representation UDP and TCP This chapter RMI and RPC

slide-4
SLIDE 4

4

4

InterProcess Communication

two basic models

shared memory message passing

two basic operations on messages

Send (to, message) Receive (from, message)

A typical communication system

slide-5
SLIDE 5

5

5

Example of Persistent Asyn. Comm.: email system Types of communication

Persistent communication – Stores message

until communicated to user

Transient communication – Stored only when

sending and receiving processes are alive

  • Transport level protocols provide transient

communication

Asynchronous – Sender continues after sending

message

Synchronous – Sender blocks until message is

stored at receiver's local buffer, delivered to receiver or processed by receiver

slide-6
SLIDE 6

6

6

c)

Transient asynchronous communication: UDP, one- way RPCs.

d)

Receipt-based transient synchronous communication

e)

Delivery-based transient synchronous communication at message delivery: Asyn. RPCs

f)

Response-based transient synchronous communication: PRCs, RMIs.

slide-7
SLIDE 7

7

7

IPC mechanisms

Pipes

processes must be related through a common

ancestor

impossible in a distributed environment

shared memory Sockets

4.4BSD Unix Java

message queues: Message-oriented

Middleware (MOM)

message agreed port any port socket socket Internet address = 138.37.88.249 Internet address = 138.37.94.248

  • ther ports

client server

slide-8
SLIDE 8

8

8

Socket Types in 4.4BSD UNIX

Stream socket: provides for the

bidirectional, reliable, sequenced, and unduplicated flow of data without record boundary.

Very similar to pipe

Datagram socket: supports bidirectional

flow of data which is not promised to be sequenced, reliable, or unduplicated

Reliability guaranteed by high-level apps. Most widely used in name service, time service.

A raw socket: provides users access to the

underlying communication protocols which support socket abstractions.

Not for general users

Sequenced packet socket: No protocol for this typ

slide-9
SLIDE 9

9

9

Socket creation: socket()

communication domains

local domain: at the same machine internet domain: Internet XNS domain: XEROX Network Systems

s = socket(domain, type, protocol);

A system call domain: AF_UNIX, AF_INET, or AF_NS type: SOCK_STREAM, SOCK_DGRAM, etc protocol: TCP or UDP. Auto selected if 0 Return a socket descriptor (a small integer for

later reference)

Ex: s = socket(AF_INET, SOCK_STREAM, 0);

Creation Failure: Reasons

Lack of memory (ENOBUFS) Unknown protocol (EPROTONOSUPPORT) Socket without supporting protocol

(EPROTOTYPE)

slide-10
SLIDE 10

10

1

Binding Names: bind()

Socket created without a name (i.e. port address)

Process has no way to access it.

System call: bind(s, address, len)

s: socket descriptor address: <local address, local port> or a path name len: the length of the address.

Connection Establishment

Asymmetric, involving a server and a client

Server: createbindlistenaccept Client: createbindconnect connect(s, address, len)

  • s: socket descriptor
  • address: server address
  • len: the length of the address
slide-11
SLIDE 11

11

1 1

Connection Failure

Timeout (ETIMEDOUT)

Server down or network corrupt

Connection refused (ECONNREFUSED)

Server not ready yet

Network down or server down

  • perational errors are returned by the underlying

communication system Unknown host

  • perational errors returned by intermediate gateways or

switching nodes.

System Call: listen()

listen(s, max_num)

s: socket descriptor max_num: the maximum number of outstanding

connections which may be queued awaiting acceptance by the server process

If the queue is full, a connection will be ignored

(instead of refused). Why?

slide-12
SLIDE 12

12

1 2

System call: accept()

newsock = accept(s, from-addr, len)

s: socket descriptor from-addr: to store the address of the client

  • Usually a pointer, could be null

len: length of from-addr Return a new socket. Usually block the caller Cannot select the client to be accepted.

Data Transfer

Once a connection is established, data flow

may begin.

write(s, buf, sizeof (buf));

send(s, buf, sizeof (buf), flags);

read(s, buf, sizeof (buf));

recv(s, buf, sizeof (buf), flags);

Flags: provide more features

slide-13
SLIDE 13

13

1 3

Discarding Sockets

close(s)

Sockets which promises reliable transmission

will still attempt transfer data. Shutdown(s, how), where how is

0: no more receiving 1: no more sending 2: no more receiving or sending

socket() close() read() connect() write() client socket() bind() listen() accept() accept() read() write() close() server Start a thread Wait for new connection

slide-14
SLIDE 14

14

1 4

Java Sockets

close() readUTF() socket() writeUTF() client socket() accept() accept() readUTF() writeUTF() close() server Start a thread Wait for new connection

slide-15
SLIDE 15

15

1 5

Java API for the Internet protocols

Transport address: IP address + port number java.net.InetAddress host name: “java.sun.com” getHostAddress(): IP address string in

textual presentation.

getHostName(): the host name for this IP

address.

32-bit integers for port number Socket types

UDP socket TCP socket

Static InetAddress.getByName(String host)

slide-16
SLIDE 16

16

1 6

UDP socket

Data unit: datagram Called datagram socket Socket must be bound to a local port and

  • ne IP address

Server: well-known port Client: any free one

issues related to datagram communication

Message size non-blocking send operations and blocking

receive operations

Timeouts

applications use UDP: Domain Naming

Service, Voice Over IP

slide-17
SLIDE 17

17

1 7

UDP socket

Encapsulated in Class DatagramSocket Datagram: Class DatagramPacket DatagramSocket.send(DatagramPacket) DatagramSocket.receive(DatagramPacket) DatagramSocket.setSoTimeout(int timeout) DatagramSocket.connect(InetAddress,

int port )

public DatagramPacket(byte[] buf,

int length, InetAddress address, int port)

slide-18
SLIDE 18

18

1 8

TCP socket

TCP is a connection-oriented protocol, a

connection is established first.

Server listens connection request Client asks for a connection Two types of TCP sockets: ordinary sockets

and server sockets

A client process constructs an ordinary

socket and then it asks for a connection with the server.

A server socket receives a connection

request, it constructs an ordinary socket with an unused port number which completes the connection.

No limit on data size. Streams: one in each direction

slide-19
SLIDE 19

19

1 9

Some issues in stream communication

Matching of data items Blocking Threads Applications use TCP: HTTP, FTP, Telnet,

SMTP.

  • rdinary TCP socket: Socket

server socket: ServerSocket

ServerSocket(int port), or

ServerSocket.bind(SocketAddress, int port);

Socket ServerSocket.accept();

InputStream and OutputStream classes An example in textbook

slide-20
SLIDE 20

20

2

Message-oriented Middleware (MOM)

Main features

intermediate-term storage for messages:

persistent !

neither sender nor receiver is required to be

active

Message queue eliminate the need for

programs to be logically connected: asynchronous !

takes minutes

Only guarantee is that a message will be

inserted in receivers’ queue. But no guarantees about when, or even if the message will actually be read

Source queue & destination queue Queue managers: Message Queue Interface

(MQI)

Overlay network

slide-21
SLIDE 21

21

2 1

Message Brokers

Issue: message format

How to make sure the receiver understands

sender’s message? One format?

Application are too diverse.

Act as an application level gateway

E.g. change delimiters at the end of records

Account Id, Trader Id, Price, Quantity, Date, Customer Id Customer Id, Account Id, Trader Id, Price, Quantity, Date Application A outputs: Application 1 inputs: Application B outputs: Application 3 inputs: Parse Rules Transform Application 2 inputs: Date, Customer Id, Account Id, Price, Quantity, Trader Id Date, Price, Quantity, Trader Id Date, Customer Id, Price, Quantity

slide-22
SLIDE 22

22

2 2

Example: IBM MQSeries

Queues

Local Queue Remote Queue Alias Queue Model Queue Some properties of local queues:

  • Maximum Message Size
  • Maximum Queue Depth
  • Enable/Disable Put or Get
  • Persistent/Not Persistent
  • Local queues can generate events (messages) under

certain conditions (like queue full).

Queue managers Channels

Message Channels: message channel agent

(MCA)

MQI channels: client channels

slide-23
SLIDE 23

23

2 3

Example: IBM MQSeries

Messages

descriptor + application data

Four types of messages:

request message reply message.

  • ne-way message

report message: generated by the Queue Manager. For

example, Delivery confirmation. Messages can have a “time-to-live”, called Expiry:

Each queue manager can have a dead-letter queue.

persistent or non-persistent messages Message Priority & Message Correlator Segmented Messages - allows ending of VERY

LARGE messages (> 100 MB)

A “reply to” address (the name of a Queue

Manager and Queue).

Messages are added and removed from queues in

Units of Work

slide-24
SLIDE 24

24

2 4

External data representation and marshalling

Heterogeneity: different representations for

simple data items.

Big Endian vs. Little Endian Solutions

transmitted in the sender’s format together with

an indication of the format used

converted to an agreed external format

An agreed standard for the representation:

external data representation

Marshaling vs. Unmarshalling CORBA’s Common Data Representation

(CDR);

Java’s object serialization; XML (Extensible Markup Language)

slide-25
SLIDE 25

25

2 5

Java object serialization

Goal: supports the encoding of objects, and

the objects reachable from them, into a stream of bytes and the complementary reconstruction of the object graph from the stream.

the state of an object sufficient information to reconstruct the

  • bject

the receiving process has no knowledge

about the types of objects

Reference: handles Objects to be serialized in the stream may

support either the Serializable or the Externalizable interface.

the “java.io.Serializable” interface

slide-26
SLIDE 26

26

2 6

Java object serialization

Serializable objects

implement the “java.io.Serializable”

interface

You can implement one or more of the methods

readObject(), writeObject() to custom serialization. Externalizable objects

implement the “java.io.Externalizable”

interface

the programmer takes full responsibility for the

serialization and deserialization of objects.

java.io.ObjectOutputStream and

java.io.ObjectInputStream

Serialization will preserve the state of all fields in

the object graph except for fields marked transient

  • r static or fields contained in superclasses that are

not serializable.

slide-27
SLIDE 27

27

2 7

Java object serialization

Visibility modifiers (e.g., private, protected,

etc.) on fields do not affect serialization.

Any subclasses of a serializable class are

serializable classes, and any data inside a serializable class are also serializable data.

Two important methods:

readObject(), reads an object from the defined

input stream

writeObject(), writes an object to an output

stream. Other methods that support the serialization

and deserialization of primitive data types: readInt, readFloat, writeInt, writeFloat, etc.