Part1 - Socket and RMI Q and A
Q : What is the differenc e between TCP and UDP?
A: TCP is designed to provide reliable communication across a variety of reliable and unreliable networks and internets. UDP provides a connectionless so it is basically an unreliable service. Delivery and duplicate protection are not guaranteed.
Q : What is socket?
A: The combination of an IP address and a port number is called a socket.
Q : What is the advantage of java socket?
A: The advantages are:
Sockets are flexible and sufficient.
Efficient socket based prog ramming can be easily implemented for g eneral communications. Sockets cause low network traffic.
Q : What is the disadvantage of java socket?
A: The disadvantages are:
Security restrictions are sometimes overbearing because a Java applet running in a Web browser is only able to establish connections to the machine where it came from, and to nowhere else on the network. Despite all of the useful and helpful Java features, Socket based communications allows only to send packets of raw data between applications. Both the client-side and server-side have to provide mechanisms to make the data useful in any way. Since the data formats and protocols remain application specific, the re-use of socket based implementations is limited.
Q : What is RMI?
A: It stands for Remote Method Invocation. RMI is a set of APIs that allows to build distributed applications. RMI uses interfaces to define remote objects to turn local method invocations into remote method invocations.
Q : What is socket()?
A: The socket() is very similar to socketPair() except that only one socket is created instead of two. This is most commonly used when if the process you wish to communicate with is not the child process.
Q : What is ServerSocket?
A: T he ServerSocket class is used to create serverSocket. T his object is used to communicate with client.
Q : What is bind()?
A: It binds the socket to the specified server and port in the SocketAddress object. Use this method if you instantiated the ServerSocket using the no-arg ument constructor.
Q : What is the Datagram?
A: A datagram is an independent, self-contained message sent over the network whose arrival, arrival time, and
content are not guaranteed.
Q : What is getLocalPort()?
A: It returns the port that the server socket is listening on. T his method is useful if you passed in 0 as the port
number in a constructor and let the server find a port for you.
Q : What is accept()?
A: It waits for an incoming client. T his method blocks until either a client connects to the server on the specified port or the socket times out, assuming that the time-out value has been set using the setSoTimeout() method. Otherwise, this method blocks indefinitely.
Q : What is the network interface?
A: A network interface is the point of interconnection between a computer and a private or public network. A network interface is generally a network interface card (NIC), but does not have to have a physical form.
Q : What is the encapsulation technique?
A: Hiding data within the class and making it available only throug h the methods. T his technique is used to protect your class against accidental changes to fields, which might leave the class in an inconsistent state.
Q : How does the race condition occur?
A: It occurs when two or more processes are reading or writing some shared data and the final result depends on who runs precisely when.
Q : What information is needed to create a TCP Socket?
A: Socket is created from this information:
Loc al System's: IP Address and Port Number
Remote System’s: IPAddress and Port Number
A: TCP is designed to provide reliable communication across a variety of reliable and unreliable networks and internets. UDP provides a connectionless so it is basically an unreliable service. Delivery and duplicate protection are not guaranteed.
Q : What is socket?
A: The combination of an IP address and a port number is called a socket.
Q : What is the advantage of java socket?
A: The advantages are:
Sockets are flexible and sufficient.
Efficient socket based prog ramming can be easily implemented for g eneral communications. Sockets cause low network traffic.
Q : What is the disadvantage of java socket?
A: The disadvantages are:
Security restrictions are sometimes overbearing because a Java applet running in a Web browser is only able to establish connections to the machine where it came from, and to nowhere else on the network. Despite all of the useful and helpful Java features, Socket based communications allows only to send packets of raw data between applications. Both the client-side and server-side have to provide mechanisms to make the data useful in any way. Since the data formats and protocols remain application specific, the re-use of socket based implementations is limited.
Q : What is RMI?
A: It stands for Remote Method Invocation. RMI is a set of APIs that allows to build distributed applications. RMI uses interfaces to define remote objects to turn local method invocations into remote method invocations.
Q : What is socket()?
A: The socket() is very similar to socketPair() except that only one socket is created instead of two. This is most commonly used when if the process you wish to communicate with is not the child process.
Q : What is ServerSocket?
A: T he ServerSocket class is used to create serverSocket. T his object is used to communicate with client.
Q : What is bind()?
A: It binds the socket to the specified server and port in the SocketAddress object. Use this method if you instantiated the ServerSocket using the no-arg ument constructor.
Q : What is the Datagram?
A: A datagram is an independent, self-contained message sent over the network whose arrival, arrival time, and
content are not guaranteed.
Q : What is getLocalPort()?
A: It returns the port that the server socket is listening on. T his method is useful if you passed in 0 as the port
number in a constructor and let the server find a port for you.
Q : What is accept()?
A: It waits for an incoming client. T his method blocks until either a client connects to the server on the specified port or the socket times out, assuming that the time-out value has been set using the setSoTimeout() method. Otherwise, this method blocks indefinitely.
Q : What is the network interface?
A: A network interface is the point of interconnection between a computer and a private or public network. A network interface is generally a network interface card (NIC), but does not have to have a physical form.
Q : What is the encapsulation technique?
A: Hiding data within the class and making it available only throug h the methods. T his technique is used to protect your class against accidental changes to fields, which might leave the class in an inconsistent state.
Q : How does the race condition occur?
A: It occurs when two or more processes are reading or writing some shared data and the final result depends on who runs precisely when.
Q : What information is needed to create a TCP Socket?
A: Socket is created from this information:
Loc al System's: IP Address and Port Number
Remote System’s: IPAddress and Port Number