1

So I have an application that runs on the Arduino that passes info over serial. I'm using a ESP2866 to make it wireless.

Arduino->Serial->Esp2866->SocketConn->JavaSocket->Console

I have a working java socket server, that I can connect to with other applications. (Java, c++, ext.) And even across the network.

I just cant seem to get my ESP2866 to connect.

Iv tried several ESP2866 units, no success. Iv tried updating the firmware on each, nope.

AT                      ->  OK
AT+RST                  ->  ready
AT+CWMODE=1             ->  OK
AT+CWJAP="name","pass"  ->  CONNECTED,GOTIP,OK
AT+CIPMUX=0             ->  OK
AT+CIFSR                ->  192.168.0.30
AT+CIPSTART="TCP","192.168.0.9","4160"  ->  ERROR

The lack of debug info is... Aggravating. Iv Seen other examples of this that worked. So whats the problem?

Additional info:

netstat -tulpn | grep 4160
tcp6       0      0 :::4160          :::*      LISTEN      23058/java   

(Edit 1:)Just tried restricting to IPV4 and rebinding the port. Nope.

InetAddress localAddress = Inet4Address.getByAddress(new byte[]{(byte) 192,(byte) 168,0,9});
System.setProperty("java.net.preferIPv4Stack", "true");
ServerSocket listener = new ServerSocket(port,20,localAddress);
//...Code to make socket work.
1

The ESP trys to connect to port 4160, but the server is listing on port 20.

  • java.net.ServerSocket.ServerSocket(int port, int backlog, InetAddress bindAddr) throws IOException – Steven Venham Jun 2 '16 at 17:00
  • try just writing ServerSocket listener = new ServerSocket(port/ *4160*/); – wiomoc Jun 2 '16 at 17:06
  • is the port answer solved your problem? – rOr oRo Oct 31 '17 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.