Note that there are some explanatory texts on larger screens.

plurals
  1. POwhy won't my client side accept anymore input
    primarykey
    data
    text
    <p>why won't my client side accept anymore input, after inputing one FIX message. The client will send a FIX message to the server side, and the server will check for errors, and send back a message back to the client if it has errors or not on the FIX message. </p> <p>The problem comes when I try to send another FIX message from the client side, prior to sending one, it won't allow me to send anything. </p> <p>Client Program</p> <pre><code>public class TcpClient { public static void main(String[] args) throws IOException { String serverHostname = new String ("WA1235"); //127.0.0.1 if (args.length &gt; 0) serverHostname = args[0]; System.out.println ("Attemping to connect to host " + serverHostname + " on port 57634."); Socket echoSocket = null; PrintWriter out = null; BufferedReader in = null; try { // echoSocket = new Socket("taranis", 7); echoSocket = new Socket(serverHostname, 57634); out = new PrintWriter(echoSocket.getOutputStream(), true); in = new BufferedReader(new InputStreamReader( echoSocket.getInputStream())); } catch (UnknownHostException e) { System.err.println("Don't know about host: " + serverHostname); System.exit(1); } catch (IOException e) { System.err.println("Couldn't get I/O for " + "the connection to: " + serverHostname); System.exit(1); } BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in)); String userInput; System.out.print ("input: "); while ((userInput = stdIn.readLine()) != null) { out.println(userInput); System.out.println(in.readLine()); System.out.println(in.readLine()); if (userInput.equals("Bye.")){ System.out.println("Exit program"); break; } getValueLog(parseFixMsg(userInput,userInput)); System.out.print ("input: "); } out.close(); in.close(); stdIn.close(); echoSocket.close(); } </code></pre> <p>Server Program</p> <pre><code>public static void main(String[] args) throws IOException{ Scanner console = new Scanner(System.in); System.out.println("Type in CSV file location: "); //String csvName = console.nextLine(); String csvName = "C:\\Users\\Downloads\\orders.csv"; ServerSocket serverSocket = null; try { serverSocket = new ServerSocket(57634); } catch (IOException e) { System.err.println("Could not listen on port: 57635."); System.exit(1); } Socket clientSocket = null; System.out.println ("Waiting for connection....."); try { clientSocket = serverSocket.accept(); } catch (IOException e) { System.err.println("Accept failed."); System.exit(1); } System.out.println ("Connection successful"); System.out.println ("Waiting for input....."); PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true); BufferedReader in = new BufferedReader( new InputStreamReader( clientSocket.getInputStream())); String inputLine, outputLine; while ((inputLine = in.readLine()) != null) { System.out.println ("Server: " + inputLine); if (inputLine.trim().equals("Bye.")) { System.out.println("Exit program"); break; } Scanner input1 = new Scanner(new File(csvName)); Scanner input2 = new Scanner(new File(csvName)); Scanner input3 = new Scanner(new File(csvName)); Scanner input4 = new Scanner(new File(csvName)); String csvline = getCsvLineVal (getLocation34CSV(getTag34Value(Tag34Location(getTagCSV( parseFixMsg(inputLine ,inputLine))), getValueCSV( parseFixMsg(inputLine ,inputLine))), getVal34(input1, input2)), getCSVLine( input3, input4) ); outputLine = compareClientFixCSV( getTagCSV( parseFixMsg(inputLine ,inputLine)), getValueCSV(parseFixMsg(inputLine ,inputLine)), getCSVTag(csvline), getCSVValue(csvline)); out.println(outputLine); input1.close(); input2.close(); input3.close(); input4.close(); } out.close(); in.close(); clientSocket.close(); serverSocket.close(); } </code></pre> <p>method</p> <pre><code>public static String compareClientFixCSV(String[] cTag, String[] cValue, String[] csvTag, String[] csvValue){ int size = csvTag.length; int size2 = csvTag.length; int size3 = cValue.length; int size4 = csvValue.length; System.out.println("cTag size : " + size + ", csvTag: " + size2); System.out.println("csvTag value : " + size3 + ", csvValue: " + size4); String output = null; for(int i = 0; i&lt;= size-1; i++){ if(cTag[i].equals(csvTag[i]) == false ){ output = ("Error in tag " + cTag[i]); } else if(cValue[i].equals(csvValue[i]) == false){ output = ("Error in value " + cValue[i]); } else{ output = ("No errors"); } } return output; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload