Search:

Type: Posts; User: Norm

Search: Search took 0.12 seconds.

  1. Replies
    37
    Views
    7,107

    [SOLVED] Re: Reply to all clients Multithreading

    That should be better.
  2. Replies
    37
    Views
    7,107

    [SOLVED] Re: Reply to all clients Multithreading

    It needs to be assigned a value so it is not null.
  3. Replies
    37
    Views
    7,107

    [SOLVED] Re: Reply to all clients Multithreading

    If you do not know which variable is null when line 36 is executed, add a println just before line 36 that prints out the values of all the variables used in line 36.
  4. Replies
    37
    Views
    7,107

    [SOLVED] Re: Reply to all clients Multithreading

    If the variable: name has a null value, the code should test its value before trying to use it where it will cause a NPE.
  5. Replies
    37
    Views
    7,107

    [SOLVED] Re: Reply to all clients Multithreading

    What variable has the null value?
    An example of how to get a NPE:

    String aStr = null;
    int len = aAStr.length(); // NPE here because aStr is null
  6. Replies
    37
    Views
    7,107

    [SOLVED] Re: Reply to all clients Multithreading

    What variable has the null value? Why doesn't it have a valid value?
  7. Replies
    37
    Views
    7,107

    [SOLVED] Re: Reply to all clients Multithreading

    Copy the full text of the error message and paste it here.
    Find the variable with the null value and backtrack in the code to see why it does not have a valid value.
  8. Replies
    37
    Views
    7,107

    [SOLVED] Re: Reply to all clients Multithreading

    Something like this:

    class ClassToHoldData {
    SomeCls item1;
    SomeOtherCls item2;
    AnotherCls item3;

    ClassToHoldData(SomeCls i1, SomeOtherCls i2, AnotherCls ac) {
    item1 = i1; ...
  9. Replies
    37
    Views
    7,107

    [SOLVED] Re: Reply to all clients Multithreading

    Parallel arraylists are going to be a problem. Put all the data into one class and save an instance of that class in the arraylist.
  10. Replies
    37
    Views
    7,107

    [SOLVED] Re: Reply to all clients Multithreading

    Why does the class extend Thread?
    How would that class be useful? The only thing it saves is a Socket. Is the all the info about a connection that needs to be saved? What about userid, status,...
  11. Replies
    37
    Views
    7,107

    [SOLVED] Re: Reply to all clients Multithreading

    It should be done where you want to save the data about a connection to a client.
    When a connection to the server is made, create an instance of the class with a reference to the Socket and save...
  12. Replies
    37
    Views
    7,107

    [SOLVED] Re: Reply to all clients Multithreading

    What is the "it" that is to be done?
  13. Replies
    37
    Views
    7,107

    [SOLVED] Re: Reply to all clients Multithreading

    You might want to keep more info about the connection than just the Socket. Define a class that contains the Socket and allows for other info about the client to be saved.
  14. Replies
    37
    Views
    7,107

    [SOLVED] Re: Reply to all clients Multithreading

    Use an ArrayList to hold the objects needed to do the posts.
  15. Replies
    37
    Views
    7,107

    [SOLVED] Re: Reply to all clients Multithreading

    Save a list of clients to send messages to. When sending a message, loop through the list and send the message to each client in the list.
Results 1 to 15 of 15