16
Group Members: Jayaweera W.J.A.I.U. 100227D Kumarasiri M.K.D.S. 100285C Liyanage K.L.D.U. 100299X Sajeewa G.K.M.C. 100470N Wijewardane M.M.D.T.K. 100612E Stream Connector

Stream connectors

Embed Size (px)

Citation preview

Group Members:

Jayaweera W.J.A.I.U. 100227D

Kumarasiri M.K.D.S. 100285C

Liyanage K.L.D.U. 100299X

Sajeewa G.K.M.C. 100470N

Wijewardane M.M.D.T.K.100612E

Stream Connector

What is a Connector?

A software connector provides one or more of four general classes of services:

Communication

Coordination

Conversion

Facilitation

What is a Stream? Streams in a software are used to transfer large

amount of data between autonomous processes.

What does the stream

connectors do?

Stream connection provides

communication services of the system to support transmission of data among components.

What other connector types

which can be connected with

stream?

Data Access Connectors To provide composite connectors for performing

database and file storage access

Event connectors To multiplex the delivery of large number of

events

Use of Stream

Connectors

Examples of Stream

Connector

Unix Pipes

TCP and UDP communication sockets

Proprietary Client-Server protocols

Unix Pipes

Keyboard Program 1

Program 3

Program 2

stdin

Display

stderrstdout/stdin

stdout/stdin

stderr

stderr

stdout

TCP/UDP Communication Sockets

Process X Process Y

…. Port N ….

TCP

…. Port N ….

TCP

IP IP

Example- Codepublic class StartGame {

Socket gameServerSocket;

InputStreamReader inputStreamReader;

BufferedReader bufferedReader;

PrintWriter printWriter;

public void startGame(){

try {

gameServerSocket = new Socket("127.0.0.1", 6000);

System.out.println( gameServerSocket.isConnected());

System.out.println("Connected!!!!!!!!!!!!!");

printWriter=new

PrintWriter(gameServerSocket.getOutputStream());

printWriter.print("JOIN#");

printWriter.flush();

Advantages of using Stream

Disadvantages of using Stream

Variations of Stream Connector

So many options are available to a software engineer to construct a stream connector.

Stream can be described according to following dimensions,

• Cardinality of communication

• Format

• Synchronicity

• Locality

• Identity

• State

• Throughput

• Buffering

• Bounds

• Delivery

Variations of Streams According to Their

Dimensions

Cardinality – number of parties involve in communication.

Format – format of data which is carried in the stream.

Synchronicity- whether stream provides synchronicity or not

Locality – scope of communication

Identity – whether the stream-base connector is named or unnamed

Variations (ctd…)

State - whether stream maintains communication state or not

Throughput – number of data units transferred in unit time

Bounds - whether the stream-base connector is bounded or unbounded

Buffering - whether it contains a buffer or not for flow control

Delivery - effort it takes to transfer data

Q & A