Network Programming Flashcards

1
Q

Client Server architecture

A

The client/server architecture that is ubiquous in networking is implicit in the foregoing description of sockets.

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

how is client/server implmented in java with Sockets

A

2 types of sockets:

1) serversocket that waits for others computers to connect to it
2) client socket that is used to connect to a server socket on some other computer(has host,port number & IP address)

Once a socket has been created we can obtain input and output streams to read ad write data to it:

InputStream is = socket.getInputStream();
OutputStream os = socket.getOutputStream();

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

More info on server socket

A

The ServerSocket class is used to create a server socket that listens for incoming client connections.

It requires a port number to listen on

It has a method accept() which blocks until a client connection is received, returns an instance of Socket representing the connection.

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

What is communication protocol?

A

When applications communicate over sockets, a protocol is neccessary.
Protocols are a set of rules for what can be sent, when and how.
It defines a conversation that the client and server can have in order to exchange data.

e.g.HTML

In only the most basic cases is a protocol unnecessary (for example a server that does nothing except stream a bunch of bytes to every client that connects to it without expecting any request parameters or reply).

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

How can a multithreaded server be simply implemented

A

Start listening.
Receive connection from client.
Launch a new thread to service the client (when done the thread can close the connection and terminate itself).
Go back to listening.

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

Why single threathed servers are of limited value?

A

More then one client

A realistic server will not handle the incoming client requests on a single thread, but will spawn a new thread (or use an existing one from a pool) to service each incoming request

The main server thus spreads almost a lot of time waiting for connections and is busy for a shorter time than a connection request timeout

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

HTTP Protocol why is it si flexible and widely used?

A

HYPERTEXT TRANSFER PROTOCOL
designed for web servers
HTTP checks for updates(ITSELF-to check if new version avaliable AND ANTIVIRUS SOFTWARE)
HTTP offers simple mechanism for obtaining any kind of data with information

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