-2
public void enviarCadena(String s){
    s="http://192.168.1.7:36000/"+s;

    try {
        url = new URL(s);
        conexion = url.openConnection();
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }catch (IOException e){

    }

}

I wrote this code. If I go to the URL in the browser, the browser sends the data to the server, but not when I execute my method in Java. The program does not throw an exception, all goes fine, but the server does not receive anything. Why?

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Kevin Lopez
  • 63
  • 1
  • 9

2 Answers2

3

openConnection() will not perform the call to the server. To do this, you need the connect() method:

conexion.connect();
Glorfindel
  • 21,988
  • 13
  • 81
  • 109
0

I discovered that the maximun size to POST is aprox 8MG, so not can send a big chain in one time, but i cuted and send in diferents times and it worked. I resolved with a read petition to open and comprove the send in the server. Thanks Glorfindel for your atempt for help me

Kevin Lopez
  • 63
  • 1
  • 9