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 Answer 1

1

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

3
  • java.net.ServerSocket.ServerSocket(int port, int backlog, InetAddress bindAddr) throws IOException Commented Jun 2, 2016 at 17:00
  • try just writing ServerSocket listener = new ServerSocket(port/ *4160*/); Commented Jun 2, 2016 at 17:06
  • is the port answer solved your problem? Commented Oct 31, 2017 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.