Saturday, June 22, 2019

Question to answer Assignment Example | Topics and Well Written Essays - 1000 words

Question to answer - Assignment ExampleFigure 1 Server listening to three lymph nodes at port number 1234 Question 2 There are basically cardinal types of socket communication inter-group communication-oriented and connection-less socket communication. Connection oriented socket communication requires handshaking from the participating ends to establish a successful connection. This kind of connection requires bi-directional communication since both the parties need to participate to establish the connection. On the contrary, connection less communication requires no such initial requirements to set up a dedicated connection between the participating ends. Connection-less communication does not require the verification of the presence of the destination. Such connections do not provide effective exercise in the presence of less speed and greater interference in the environment. Stream sockets are used for connection oriented socket communication when reliability is immanent in t he transfer of info and messages. Datagram sockets are used for connection less communication when reliability is not crucial. Question 3 A series of go has to be followed to enable successful communication between the client and the server. The first step involves the creation of the socket by creating an object of the class Socket. The parameters in the creation of the socket determine the network protocol that will be created. The second step is binding the socket to a network interface this is done by specifying a local conduct and a port number. The third step is to connect to a remote server it should be verified that the server is in listening state to provide the requests of the clients. After a successful connection, transferring of data can take place by either send or receive functions. After the transfer of data and required operations, it is a good practice to close the socket so that the resource can be freed. Question 4 The socket is used to establish the connect ion from the clients side. An object of the socket class is created to communicate with the available server and send requests to it. The server socket is used at the server side to listen to all the objects that ask to communicate with the server and send requests. The socket server listens to clients that are bound to the same port address as the server. Question 5 Threads are define as a set of logic and statements that execute in isolation from each other. According to Shaw (2011), there might be multiple threads in a multithreaded environment where they will be sharing computing resources with each other. Threads enable programs to operate faster and stay more responsive to exploiter input. Each thread is assigned a fraction of the time slice to execute and proceed in its own set of statements and commands. A scheduler has the responsibility of appoint time slices to all the threads. The high level states of threads are ready, running, waiting and dead. Figure 2 States of t hreads (eTutorials.org, 2008) Question 6 There are two main methods of threads that enable smooth execution of all operations and functions synchronization and scheduling. Synchronization As stated earlier, multiple threads can embody in a multithreaded environment. The threads have their own registers and stack but they might be sharing some data or resources that would require observe for its consistency and accuracy.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.