TCP Flashcards

1
Q

Describe the steps of a TCP client

A

1) Make a socket and connect it to a port
2) Prepare input stream (from server)
3) Prepare output stream (to server)
4) Write request bytes to output stream
5) Read response bytes from input stream
6) …
7) Close socket and terminate connection

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Describe the steps of a TCP server

A

1) Make a ServerSocket with known port
2) (repeat)
3) .accept a new client connection represented by a new Socket
4) Make a thread to handle the client

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Name 4 TCP considerations

A

Message size, message destination, blocking, failure model

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe message size

A

Application reads/writes any number of bytes at a time until the connection is closed - the application does not see any message boundaries so needs to communicate boundaries explicitly in the bytes sent

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe message destination

A

A server can accept connection requests from any client - once the connection is established then bytes are communicated only between that pair of processes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Describe blocking

A

A limited amount of data is buffered at sender and receiver sockets and sends will block once the sender buffer is full (known as flow control)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Describe failure model

A

Communication is reliable short of complete connection failure
Lost messages are automatically retransmitted, duplicate packets are discarded and out-of-order packets are reordered using sequence numbered
If a loss is not resolved within a time limit then the whole connection fails

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Describe the uses of TCP

A

Can transfer almost all data reliably and/or in large amounts
e.g. HTTP, SSH, FTP, SMTP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly