/
Socket Socket

Socket - PowerPoint Presentation

olivia-moreira
olivia-moreira . @olivia-moreira
Follow
385 views
Uploaded On 2016-07-16

Socket - PPT Presentation

Programming with TCP and UDP Julia Ljunbjörk and Anita Mugenyi What is a socket Like a house Between the layers Socket programming Client server Two ways Socket ID: 406513

server socket client clientsocket socket server clientsocket client line programming tcp datagram create port request serversocket connectionsocket read hostid

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Socket" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Socket Programming with TCP and UDP

Julia Ljunbjörk and Anita MugenyiSlide2

What is a socket?

Like a house

Between

the

layersSlide3

Socket programming

Client

–server

Two

ways

Slide4

Socket programming

A

client

reads a

line

from

its

standard input (keyboard) and

sends

the

line

out

its

socket

to the server

The server reads a

line

from

its

socket

The server

converts

the

line

to

uppercase

The server

sends

the

modified

line

out

its

socket

to the

client

The

client

reads the

modified

line

from

its

socket

and

prints

the

line

on

its

standard output(monitor)Slide5

process

TCP with

buffers,

variables

socket

host or

server

process

TCP with

buffers,

variables

socket

host or

server

Internet

controlled by

app developerSlide6

Socket programming with TCP

Reliable, byte stream-oriented

Three-way

handshake

Three

sockets

StreamsSlide7

wait for incoming

connection request

connectionSocket =

welcomeSocket.accept()

create socket,

port=

x

, for

incoming request:

welcomeSocket =

ServerSocket()

create socket,

connect to

hostid

, port=

x

clientSocket =

Socket()

close

connectionSocket

read reply from

clientSocket

close

clientSocket

Server

(running on

hostid

)

Client

send request using

clientSocket

read request from

connectionSocket

write reply to

connectionSocket

TCP

connection setupSlide8

Socket programming with UDP

No

streams

No

connection

Datagram

socket

Individual

packetsSlide9

Server

(running on

hostid

)

close

clientSocket

read datagram from

clientSocket

create socket,

clientSocket =

DatagramSocket()

Client

Create datagram with server IP and

port=x; send datagram via

clientSocket

create socket,

port= x.

serverSocket =

DatagramSocket()

read datagram from

serverSocket

write reply to

serverSocket

specifying

client address,

port numberSlide10

Thank you for your time!