Quantcast
Channel: Android Mode - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 941

Android WIFI TCP Communication - can not communication

$
0
0

Hi, nice to meet you. Please help me.

#1. Hardware 1) Smartphone 2) ESP8266-01 & Arduino

#2. Software Processing 1) TCP Communication Code

---------------------------------------------------

` import oscP5.*; import netP5.*;

OscP5 oscP5tcpServer;

OscP5 oscP5tcpClient;

NetAddress myServerAddress;

void setup() {
  /* create  an oscP5 instance using TCP listening @ port 11000 */
  oscP5tcpServer = new OscP5(this, 22000, OscP5.TCP);

  /* create an oscP5 instance using TCP.
   * the remote address is 127.0.0.1 @ port 11000 = the server from above
   */
  oscP5tcpClient = new OscP5(this, "192.168.4.1", 22001, OscP5.TCP);
}


void draw() {
  background(0);
}


void mousePressed() {
  /* the tcp client sends a message to the server it is connected to.*/
  oscP5tcpClient.send("/test", new Object[] {new Integer(1)});
}


void keyPressed() {
  /* check how many clients are connected to the server. */
  println(oscP5tcpServer.tcpServer().getClients().length);
}

void oscEvent(OscMessage theMessage) {
  /* in this example, both the server and the client share this oscEvent method */
  System.out.println("### got a message " + theMessage);
  if(theMessage.checkAddrPattern("/test")) {
    /* message was send from the tcp client */
    OscMessage m = new OscMessage("/response");
    m.add("server response: got it");
    /* server responds to the client's message */
    oscP5tcpServer.send(m,theMessage.tcpConnection());
  }
}

`


#3. Problem 1) TCP Comunication - Smartphone → ESP8266-01 & Arduino : Very Well ** 2) TCP Comunication - ESP8266-01 & Arduino → Smartphone** : Error and Shut Down.

**I do not know what the reason. **

I hope someone hoping to me is hope. Please answer fast.


Viewing all articles
Browse latest Browse all 941

Trending Articles