Terminal, blocking text input... a way around?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • linksterman
    New Member
    • Jul 2007
    • 38

    Terminal, blocking text input... a way around?

    I am currently writing a server based IM type of a program for my java class. The problem is that the client (which runs in a terminal) blocks all incoming traffic as it waits for you to type a message. My question is how do I get around this? I tried creating a tread whose only purpose was to listen on the incoming port and print the message to the screen. But that didnt work. So I am kind of running out of ideas here. Any ideas on how to make this work (I thought of possibly doing a key combo like ctrl+t and have it prompt you for the message, and all the rest of the time listening, but I cant find anywhere that has it for the terminal. they are all for gui stuff)
  • BigDaddyLH
    Recognized Expert Top Contributor
    • Dec 2007
    • 1216

    #2
    Originally posted by linksterman
    I am currently writing a server based IM type of a program for my java class. The problem is that the client (which runs in a terminal) blocks all incoming traffic as it waits for you to type a message. My question is how do I get around this? I tried creating a tread whose only purpose was to listen on the incoming port and print the message to the screen. But that didnt work. So I am kind of running out of ideas here. Any ideas on how to make this work (I thought of possibly doing a key combo like ctrl+t and have it prompt you for the message, and all the rest of the time listening, but I cant find anywhere that has it for the terminal. they are all for gui stuff)
    By "runs in a terminal" do you mean your program uses console I/O? In that case, you may want to have a Swing GUI and use different text areas to keep what the user initially writes separate from incoming text. Nevertheless, multithreading will be hard to avoid.

    Comment

    Working...