top of page
racalescapode

Sumita Arora Informatics Practices Class 12.pdf REPACK







Sumita Arora Informatics Practices Class 12.pdf Free Informatics Practices for Class XII Sumita Arora Informatics Practices Class 12 Free IIT JEE Physics.Q: Java Networking: reading/writing from/to a String list Please help me understand what I am doing wrong. I am new to Java. Let me explain the situation: I have a client (A) and a server (B). A sends messages to B at regular interval, say every 5 seconds. B is running an ordinary server and it has a list to save all these messages from A. 1) Once B is running, A puts all his messages into a String list. Now, I want to start a second thread in B to write all the messages in the list (list) into a csv file and this should be a continuous process. 2) After writing, B should remove the message from the list (list). 3) B should reply back with 'OK' to A. This should be a blocking process. I am able to compile and run the code and the flow of data seems to be working fine (the csv file is created). When I am sending messages from A to B, everything works fine. The issue comes when I want to send messages from B to A. I am always getting 'null pointer' exception in the following code, although I have checked with debug. Client Code: public class Client { String list= "client.txt"; String msg = ""; public static void main(String[] args) throws Exception { try { Socket s = new Socket(address,port); ClientConnection connection = new ClientConnection(s); connection.waitForConnection(); while(true) { msg = connection.getOutputMessage(); list.add(msg); if (list.size() > 3) { Thread t 1cdb36666d


Related links:

9 views0 comments

Recent Posts

See All

Comments


bottom of page