Network Programming Flashcards

1
Q

TCP

A

Transmission Control Protocol

Prevents errors with package loss, out of order, duplicated, etc.

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

UDP

A

User Datagram Protocol

Provides no protection against package errors

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

Socket

A

An application can use a socket to communicate with another process - can be used like a file to read/write to

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

AF_UNIX domain

A

Used for local communication

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

AF_INET, AF_INET6

A

INET for IPv4 internet protocols, INET6 for IPv6 internet protocols

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

IPv4 vs IPv6

A

IPv4 uses 32 bit IP address, IPv6 uses 128 bit IP addresses

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

TCP Server Socket Sequence

A
  1. socket
  2. bind
  3. listen
  4. accept.
  5. read
  6. write
  7. close
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

UDP Client Socket Sequence

A
  1. socket
  2. connect
  3. write
  4. read
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

bind()

A

binds a socket to an address, used by server

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

listen()

A

marks the socket as passive, used to wait for a connection to come

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

accept()

A

returns a new connection, i.e. a new socket to use for connection

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

connect()

A

connect to passive socket, used by client

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

Connection-oriented

A

make a connection first before transmitting any data

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

UDP server socket sequence

A
  1. socket
  2. bind
  3. recvfrom
  4. sendto
  5. close
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

sendto, recvfrom vs. read, write

A

read, write are universal file descriptor functions, the others are socket-specific

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

AF_INET vs AF_INET6

A

AF_INET uses 4 bytes for addresses, AF_INET6 uses 16 bytes for addresses

17
Q

Loopback address

A

127.0.0.1 - INADDR_LOOPBACK

refers to local address

18
Q

Wildcard address

A

INADDR_ANY

binding a socket to the wildcard address tells the OS we want to listen on any address

19
Q

Ephemeral port

A

If you don’t call bind, then a port number will be chosen for you

20
Q

Little endian vs. big endian

A

Little endian: little end/least sig. byte goes first
Big endian: big end/most sig. byte goes first