Interview questions on socket program in java




















Efficient socket based programming can be easily implemented for general communications. Sockets cause low network traffic. Unlike HTML forms and CGI scripts that generate and transfer whole web pages for each new request, Java applets can send only necessary updated information. Disadvantages of Java Sockets: 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. A NULL pointer is a pointer of any type whose value is zero.

A void pointer is a pointer to an object of an unknown type, and is guaranteed to have enough bits to hold a pointer to any object. A void pointer is not guaranteed to have enough bits to point to a function though in general practice it does. Both the client side and server side have to provide mechanisms to make the data useful in any way. Sockets are flexible and sufficient. Efficient socket based programming can be easily implemented for general communications.

It refers to writing programs that executes across multiple devices computers , in which the devices are all connected to each other using a network. Interview Star By Sohail Anwar. Sunday, August 1, Question 1: How does the race condition occur? Question 2: What is multiprogramming? Question 5: What does a socket consists of? A socket is one end-point of a two-way communication link between two programs running on the network.

Socket classes are used to represent the connection between a client program and a server program. The java. It occurs when two or more processes are reading or writing some shared data and the final result depends on who runs precisely when.

Multiprogramming is a rapid switching of the CPU back and forth between processes. Physical Layer - covers the physical interface between devices and the rules by which bits are passed from one to another. Data Link Layer - attempts o make the physical link reliable and provides the means to activate, maintain, and deactivate the link.

Network Layer - provides for the transfer of information between end systems across some sort communications network. For most operations using sockets, the roles of client and server must be assigned. A server is a process which does some function on request from a client. As will be seen in this discussion, the roles are not symmetric and cannot be reversed without some effort.

The connectionless or datagram mode between client and server on different hosts is not explicitly discussed here. Its use can be inferred from the presentations made in Stages 1 and 3. Popular Interview Questions. All Interview Questions. All Practice Tests. IT Skills. Management Skills. Communication Skills.

Business Skills. Digital Marketing Skills. Human Resources Skills. Health Care Skills. Finance Skills. All Courses. Question 1. What Is Socket? UML Tutorial Question 5. Python Interview Questions Question 6. Answer : Advantages of Java Sockets: Sockets are flexible and sufficient.

Efficient socket based programming can be easily implemented for general communications. Sockets cause low network traffic. Unlike HTML forms and CGI scripts that generate and transfer whole web pages for each new request, Java applets can send only necessary updated information. Disadvantages of Java Sockets: 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. Android Interview Questions Question On the server side, you can use the class PrintStream to send information to the client. Android Tutorial Question Java-Multithreading Interview Questions Question Some characteristics of this technique include: The server can handle multiple client requests for connection and service.

The server responds to any one client's request independently of all other clients. A client knows how to establish a connection with the server. As a result, the process receiving a message processes that message by the following rules: The data transmitted has no boundaries. All bytes in a received message must be read before the next message can be processed.

Bytes in a received message can be read in a loop program control structure since no data bytes are discarded. The server will usually fork a child process upon establishment of a client connection. This child server process is designed to communicate with exactly one client process. The child server process performs the requested service for its connected client. The child server process terminates when the service request has been completed.

A value of 0 is return on success. On failure, -1 is returned with errno describing the error. Example: struct sockaddr name; int s; name. This description of the use of sockets progresses in three stages: The use of sockets in a connectionless or datagram mode between client and server processes on the same host. In this situation, the client does not explicitly establish a connection with the server. The client, of course, must know the server's address.

The server, in turn, simply waits for a message to show up. The client's address is one of the parameters of the message receive request and is used by the server for response. The use of sockets in a connected mode between client and server on the same host.



0コメント

  • 1000 / 1000