Network Programming Flashcards

1
Q

What does Socket API do?

A

it allows processes to communicate with eachother across the network. It also allows you to write programs that are largely independent of lower protocols.

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

How does a Socket API work?

A

Two sockets are required for an end-to-end communication. The sockets must be created at both ends, binded to a named local address, and optionally connected to a (remote) socket. A socket identifier is then returned (similar to a file ID) which is passed to forked (system call) child processes to support multithread processing.

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

What are the three types of sockets supported by the Java networking package?

A

Stream sockets
Datagram sockets
Multicast sockets

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

What is a stream socket and when would you use it?

A

It is socket that allows processes to communicate using TCP. It provides bidirectional, reliable, sequences, and unduplicated flow of data with no record boundaries. They are used for file transfer type applications for reliability.

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

What is a datagram socket and when would it be used?

A

It is a socket that allows processes to use UDP to communciate. It supports bidirectional flow of messages. Can receive messages in a different order than sent and can receive duplicate messages. It is used for VOIP type applications.

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

Explain both communication types.

A

Socket-based communication: (TCP) applications view networking as streams of data. It is a connection-based protocol. File I/O stream is used to read/write from sockets.

Packet-based communication: (UDP) individual packets transmitted, uses a connectionless service. Useful when you want to use flow control etc.

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

What is a socket?

A

one end-point of a two way communication link between two programs running on the network.

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

What are the two socket classes? Why are they used?

A

socket and serverSocket

They are used to represent the connection between a client program and a server program.

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

Describe how a connectionless server/client transmission works.

A

There is no connection maintained with the other computer. The message is broken down into equal sized pieces and sent as packets. There is no guarantee that messages arrive, or that they arrive in order. The receiver puts the message in order and reads them.

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