Search:

Type: Posts; User: Norm

Search: Search took 0.10 seconds.

  1. Replies
    24
    Views
    3,071

    Re: Questions on simple client-server app

    Forget about the source of a thread. That is not important. All code executes on a thread. Then consider what the API doc that you read says:
    Only one thread at a time can own an object's monitor.
  2. Replies
    24
    Views
    3,071

    Re: Questions on simple client-server app

    One thread you are given by the JVM. Use that one to handle user input.
    You create one thread to wait on the messages from the server.


    None of the code I've written that has used synchronized...
  3. Replies
    24
    Views
    3,071

    Re: Questions on simple client-server app

    Yes that is what I mean.
    All code runs on a thread. You can get a thread several ways.
    Extending Thread is ONE way. Using new Thread() is another way to create a new thread when you need to have...
  4. Replies
    24
    Views
    3,071

    Re: Questions on simple client-server app

    None of them do.

    Extending the Thread class is not an issue.
  5. Replies
    24
    Views
    3,071

    Re: Questions on simple client-server app

    Please post a link to the other forum.
  6. Replies
    24
    Views
    3,071

    Re: Questions on simple client-server app

    I'm always interested in learning new techniques:
    If the client does not have a separate thread for listening for messages from the server, how does it work?
    One way clients work is to build a GUI,...
  7. Replies
    24
    Views
    3,071

    Re: Questions on simple client-server app

    Ok. But bottom line: all code executes on a thread. Your program is given one thread to execute on when it starts. If you need more, use the Thread class to ask the JVM to give you another one.
  8. Replies
    24
    Views
    3,071

    Re: Questions on simple client-server app

    objects don't execute. The code in an object executes on a thread. In fact the code in an object can execute on several different threads concurrently.

    If the loop that waits is on its own thread,...
  9. Replies
    24
    Views
    3,071

    Re: Questions on simple client-server app

    All code executes on a thread.


    That makes the communications like broadcasts. There are no expected responses to the message being sent. So there is no waiting for the response. Send the message...
  10. Replies
    24
    Views
    3,071

    Re: Questions on simple client-server app

    Not sure what would happen or why you want to do it that way.
    What do you mean by the "client object"? Execution is in threads. Objects contain methods and data.
    I would create a thread for each...
  11. Replies
    24
    Views
    3,071

    Re: Questions on simple client-server app

    Then you would need to use a thread for each send message/receive response communication.
  12. Replies
    24
    Views
    3,071

    Re: Questions on simple client-server app

    How does the client work? Does it send a message to the server and then wait for the response?
    If you need the client to be doing something else while it is waiting for the response, then put the...
Results 1 to 12 of 12