• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sockets Java X PHP

 
Paulo Cesar M. Jeveaux
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Staff
I am needing an urgent aid of you. I am with a problem in a project that I am working. I hava a server that it generates random values given for the tests during the course of the project, however is in PHP and I have that to make a connection he saw socket of an Applet for it. Until there everything ok.
The connection he saw socket, is not the problem, the stretch above functions well, I see in the server who the process initiated, but serving one sends given its I to send a String for it, and only is there that it is the problem, the necessary server to receive the String "GET / HTTP/1.9\n\n" in method "output.writeObject("GET HTTP/1.0\n\n")" and when send is String it alone receive 1(one), is a mount of ones...
And latter is all motionless one, obviously wainting in "input ObjectInputStream = (sckt.getInputStream())", because the server did not receive the String.
If somebady will have some idea or solution, order there... PLEASE.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Welcome to JavaRanch!
Do not use ObjectOutputStream to communicate between Java and PHP (or between Java and anything else.) ObjectOutputStream is used to send a binrary representation of a Java object, and this representation is useless to any non-Java program. What you want to do could look like

Of course, Java includes tools to implement the HTTP protocol more simply. You might want to go and read Sun's Java networking tutorial to learn about the URLConnection class.
 
Paulo Cesar M. Jeveaux
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Very obliged, I had finished to make the method below, the server already I was being initiated, however he had a StreamCorruptedException exception. Very obliged for the aid.

I forgive for my English, I am Brazilian...
If you to want to visit my site on java visits - www.portaljava.com - It is one of the greaters of Brazil ....
THANK YOU...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!