console reading and writing to a socket

Discussion in 'Java' started by -, Mar 21, 2005.

  1. -

    - Guest

    i have a class that listens to and sends messages from and to a socket.
    it's console based and when i run it on eclipse i can only see the
    system.out.println(..) of the messages received.

    i know the solution if it's gui based but in this case, what should i do
    to have a way to input the data while at the same time reading what is
    received. can an IDE do that?
    -, Mar 21, 2005
    #1
    1. Advertising

  2. On Mon, 21 Mar 2005 17:16:18 +0800, - wrote:
    > i have a class that listens to and sends messages from and to a
    > socket. it's console based and when i run it on eclipse i can only
    > see the system.out.println(..) of the messages received.
    >
    > i know the solution if it's gui based but in this case, what should
    > i do to have a way to input the data while at the same time reading
    > what is received. can an IDE do that?


    You can:

    - use separate threads for console and socket IO

    or

    - use a java.nio Selector, which lets you multplex IO from several
    sources using a single thread

    /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, Mar 21, 2005
    #2
    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. lec
    Replies:
    1
    Views:
    389
    Grant Edwards
    Jul 17, 2003
  2. Miktor
    Replies:
    7
    Views:
    11,996
    Joe Bacigalupa
    Aug 9, 2005
  3. Replies:
    5
    Views:
    3,411
    James Kanze
    Mar 4, 2008
  4. Laszlo Nagy
    Replies:
    1
    Views:
    4,759
    Mark Wooding
    Jan 27, 2009
  5. Jean-Paul Calderone
    Replies:
    0
    Views:
    942
    Jean-Paul Calderone
    Jan 27, 2009
Loading...

Share This Page