
-----------------------------------
S_Grimm
Mon Nov 03, 2008 12:08 pm

Determining if an input  has value.
-----------------------------------
First, i apoligise for the title. didn't know how else to word this. What i want is to be able to check if a network input has a value so what i have is :

import java.net.*;
import java.io.*;
public class chatServerv2p8
{
    public static InputStreamReader reader = new InputStreamReader (System.in);
    public static BufferedReader input = new BufferedReader (reader);
    public static String NumConnecting;
    public static Object Convert = new Object ();
    public static int count;
    public static Socket 

I need a way to replace the

            try
            {
            if ((datavar = br 
with a simpiler statement that:
a) checks for text over the network
b) if text is present, interrupts user input and prints text, then allows user to continue
c) if text is NOT present, allows user to continue inputting

Thanks in advance.
A\V

-----------------------------------
btiffin
Mon Nov 03, 2008 8:45 pm

RE:Determining if an input  has value.
-----------------------------------
A\V;  Looks like you are digging in quite nicely.

Umm, what if you separate the user input, text output and network I/O into Threads?  Would the problem not disappear?

Given this is Java, I don't think a modular approach like that will make the code overly complex.  It could simplify a few things.

Cheers

-----------------------------------
S_Grimm
Tue Nov 04, 2008 11:22 am

Re: Determining if an input  has value.
-----------------------------------
Umm, what if you separate the user input, text output and network I/O into Threads?
I thought they were.... That is how i was told to delcare threads. Do you mean make more threads? One to read the user input, one to read the network input. one to write the user input to the network, and one to print the network input?
