Java Sockets Flashcards

1
Q

How do machines connect to the internet?

A

Using either TCP or UDP.
It’s a layered system
Your programs will be at the application layer.

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

TCP properties

A

Same as a telephone conversation
Link between 2 machines
TCP guarantees the order of data once the machine and port is established
Essential to HTTP FTP telnet etc

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

UDP properties

A

UDP is similar to postal service
Order is not guaranteed and neither is delivery.
UDP does not have the error checking and ordering overheads of TCP.
UDP is not connection based. It sends datagrams from one app to another.

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

What are ports?

A

Ports allow a computer to siphon data to the different applications running on the machine.
Data over the internet has an ip address and port associated with it.
In UDP the datagram packet contains the port number and is routed based on that.

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

What are sockets?

A

A server will run on a specific PC (IP address) and has a socket bound to a particular port for a client to make a request
The client must know the server hostname and port where the server will be listening.
The client needs its own port to accept communication from the server.

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

Steps for reading from/writing to sockets

A
Open socket
Open input and output stream to socket
Read and write from stream accoring to protocol
Close streams
Close socket.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly