Need help with interclass communication

Discussion in 'Java' started by Shmuel, Jun 2, 2004.

  1. Shmuel

    Shmuel Guest

    Hi,
    I'm trying to do a communication program. I use ServerSocket.
    I just can't figure out how to communicate between them.

    I have a JTextArea where I show the output from the server and
    the server consists of two classes the Server class and a Thread class.

    Now, I should have access from the thread class to the JTextArea.
    Any idea how this could be done ?

    The main program is a Java Applet.
    So at the moment there are 3 classes.

    I know this could be done via RMI, but is that the
    only solution?

    Any better ideas how this could be done ?
    Shmuel, Jun 2, 2004
    #1
    1. Advertising

  2. Thomas Weidenfeller, Jun 2, 2004
    #2
    1. Advertising

  3. Shmuel

    Shmuel Guest

    Ha, ha! Any better ideas?
    I mean communication between a Thread class and with an another class.

    Thomas Weidenfeller wrote:
    > Shmuel wrote:
    >
    >>
    >> Hi,
    >> I'm trying to do a communication program. I use ServerSocket.
    >> I just can't figure out how to communicate between them.

    >
    >
    > http://java.sun.com/docs/books/tutorial/index.html
    >
    > /Thomas
    Shmuel, Jun 2, 2004
    #3
  4. On Wed, 02 Jun 2004 12:27:31 +0300, Shmuel wrote:
    > Ha, ha! Any better ideas?
    > I mean communication between a Thread class and with an another
    > class.


    Why do you (think you) want to use a ServerSocket or RMI for that? You
    can use method invokation and reference passing to communicate between
    threads within the same JVM.

    So far I don't think anybody really understands what you're trying to
    do, since all of your posts have been extremely vague. Put some effort
    into your posts, and you'll get much better help.

    /gordon

    --
    [ do not email me copies of your followups ]
    g o r d o n + n e w s @ b a l d e r 1 3 . s e
    Gordon Beaton, Jun 2, 2004
    #4
  5. Shmuel wrote:
    > Ha, ha! Any better ideas?


    Sure.

    What about you spending some more time to write a useful problem
    description? After you have read all the relevant tutorials?

    What about you posting to comp.lang.java.help, where beginner's
    questions are better placed?

    /Thomas
    Thomas Weidenfeller, Jun 2, 2004
    #5
  6. Shmuel

    Roedy Green Guest

    On Wed, 02 Jun 2004 12:27:31 +0300, Shmuel <> wrote or
    quoted :

    >I mean communication between a Thread class and with an another class.


    you could use a pipe. See http://mindprod.com/fileio.html.

    You could use a fifo queue of some sort.

    You could use shared variables.

    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
    Roedy Green, Jun 2, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Howard
    Replies:
    1
    Views:
    563
    Felix Wang
    Jan 9, 2004
  2. Replies:
    2
    Views:
    403
    Roedy Green
    Oct 10, 2005
  3. shashi
    Replies:
    0
    Views:
    323
    shashi
    Nov 18, 2004
  4. shashi
    Replies:
    1
    Views:
    355
    Miki Tebeka
    Nov 18, 2004
  5. tahir
    Replies:
    2
    Views:
    1,249
Loading...

Share This Page