Socket in computer network Flashcards

1
Q

What is a socket?

A

1 endpoint of a 2 way communication link between 2 programs running on a network.
Each socket has a specific address, composed of an IP and a port

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

How is a connection established with the socket technique?

A
  • Server creates socket, attaches it to a network port addres,
  • then waits for the client to contact it
  • client creates a socket, then attempts to connect to the server socket
  • when connection is established -> data transfer takes place
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Name the 2 types of sockets

A

Datagram socket
Stream socket

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

What is a datagram socket?

A

Type of network which has connection less points for sending and receiving packets. (Similar to mailbox
-> The letters (data) posted into the box are collected and delivered (transmitted) to a letterbox (receiving socket) )

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

What is a stream socket?

A
  • Type of network socket which provides a connection-oriented,
    sequenced, and unique flow of data
  • without record boundaries
  • with well defined mechanisms for creating and
    destroying connections and for detecting errors. (Similar to phone
    -> Connection is established between the phones (two ends) and a conversation (transfer of data) takes place.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What parameter to the sock function is used to store IPv4 address?

A

socket.AF_INET

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

What parameter to the sock function is used to store the protocol (tcp)?

A

sock.SOCK_STREAM

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