Client-Server Networking Between PHP Client and Java Server?

According to the java documentation StreamCorruptedException is "Thrown when control information that was read from an object stream violates internal consistency checks. " I doubt your PHP app is sending what Java considers a serialized object. Why don't you go low-tech and read a string?

The following had worked for me back in the day.

According to the java documentation StreamCorruptedException is "Thrown when control information that was read from an object stream violates internal consistency checks. " I doubt your PHP app is sending what Java considers a serialized object. Why don't you go low-tech and read a string?

The following had worked for me back in the day: ServerSocket serverSocket = new ServerSocket(port); Socket clientSocket = serverSocket.accept(); BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); while((inputLine = in.readLine())! =null) { //Do whatever }.

Yea, this seems logical. I'll certainly give it a try today and will get back here with the result. Thanks for reply.

– Muhammad Yasir Apr 21 '10 at 11:23 Your doubt was right buddy. PHP application really sends it in the form of a string. So I was able to do my task by using the code you provided :) Thanks a lot!

– Muhammad Yasir Apr 22 '10 at 7:13.

You might try looking into Quercus. It's a server that runs PHP inside java. You can call java called directly from PHP as if it was native PHP functions.

You won't have to worry about streams then.

Hmm so Quercus is a webserver. It means: 1. My project will require to be run on a server which runs Quercus instead of Apache or IIS.2.

Both web as well as desktop application require to be run on a single machine. These are two problems that may make it unacceptable again. Please correct me if I am taking it wrong.

Also, thanks for your quick reply. – Muhammad Yasir Apr 21 '10 at 10:40 You mentioned you tried a java server and a php server, Quercus would provide both in one (it's free, like Apache). Both your PHP and Java clients should work fine connecting with a Quercus server.

Quercus should solve your problem of "crossing them". Not sure what you mean by #2. – Brent Baisley Apr 22 '10 at 13:03 May be I was not clear enough in my question or comment.

What I want to say is that I have a PHP application (website) and a Desktop application written in Java. Now this package is for non-tech, business type user. He/she would like to run Java desktop app on a pc; and website online, by utilizing hosting provided by any generic web host.It is clear that normally used webservers by hosts are usually Apache or IIS.

So if I bind user to use quercus, it will be a drawback and my uni won't accept it. Point 2 means user has to host website and desktop app on a single machine which is not desired. – Muhammad Yasir Apr 24 '10 at 5:53 When you said you made a "java server", I assumed you weren't restricted to just plain Apache/IIS.

Most hosting providers do not support java on the basic tier. – Brent Baisley Apr 24 '10 at 15:46.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions