I had written a java server program which will be requested from a php
script .
Actually ,It 's being used as a database server for my web-based chat .

Means ..,it stores the information like chat messages ,online
users..and so on
the information will be sent and retrieved from different php scripts.
I am opening a socket connection from php to communicate with java
server and sending some data like
$in = "PUT\r\n$userID\r\n$toID\r\n$msg\r\n$time\r\n";
socket_write($socket, $in, strlen($in));

My java server will create a thread for each connection and start
running it.
In thread ,I am receiving the data coming from socket as .....

BufferedReader br = new BufferedReader( new InputStreamReader(
sk.getInputStream() ));
String action = br.readLine();

if (action == null ) {System.out.println("some null..
returning"); }

/*Some Code*/


catch(Exception e)
System.out.println("error1234:"); e.printStackTrace();


It's working almost fine and there is no problem with my logic and
But for some requests from php ,the String 'action' is being null
and no code will be executed in thread .The string 'action' should be a
valid String so that one action in java server can be performed..
But some times as the String being null ,no action will be performed
..It will be a big problem when the action is to PUT or GET the
messages .

I am unable to find what exactly the problem is........
Is it the problem with php socket_write() or java br.readLine() function?

Any help to find what the problem is ..(and also solution ) will be
greately appreciated...