i have x, y and z co-ordinates being sent over a socket every second, i want to store these in an array and the then read the three coordinates seperatley. can someone please help!
Thanks!!
Code:
import java.io.*;
import java.net.*;
import java.util.Scanner;
import java.io.File;
public class Combo2 {
public static void main(String[] args) throws IOException {
Socket kkSocket = null;
PrintWriter out = null;
BufferedReader in = null;
File yourFile = new File("outs.txt");
yourFile.delete();
try {
kkSocket = new Socket("192.168.33.39", 12000);
out = new PrintWriter(kkSocket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(kkSocket.getInputStream()));
} catch (UnknownHostException e) {
System.err.println("Don't know about host: Adam.");
System.exit(1);
} catch (IOException e) {
System.err.println("Couldn't get I/O for the connection to: Adam.");
System.exit(1);
}
BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
String fromServer;
String fromUser;
while ((fromServer = in.readLine()) != null)
{
if (fromServer.equals("Bye."))
break;
try{
// Create file
BufferedWriter a = new BufferedWriter(a);
outs.write( fromServer);
outs.newLine();
//Close the output stream
outs.close();
}
