0

I have a java socket server and php. The socket is working perfectly but not the input/output streams.

String loginQuery = is.readLine();

if (!loginQuery.equalsIgnoreCase(salt))return;

while (true) {
    String outQuery = "";
    is = new DataInputStream(clientSocket.getInputStream());
    os = new PrintStream(clientSocket.getOutputStream());
    String clientSentence = is.readLine();
    System.out.println(clientSentence);
    //here are some if's which change the outQuery string...
    os.println(outQuery);
}

PHP:

$st = $salt."\n";
$socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n");
$result = socket_connect($socket, $host, $port);
socket_write($socket, $st);
socket_write($socket, "ram\n", 5);
$resp = socket_read($socket, 1024);

And in the Java console I get "null" 50 times/second. Any ideas?

4

0 回答 0