user61512: I want to simply send data from one MKR1000 to the other over wifi, both are connected to the same network, but sending the data is where I get stuck, I've looked through tuts everywhere but can't seem to find an answer.. can someone point me to a solution?
I've set up my devices using the tut https://www.arduino.cc/en/Tutorial/Wifi101WiFiChatServer
but the devices don't communicate to each other they only take telnet from the host server(my laptops wifi hotspot)

user37622: WiFiClient object wraps a TCP socket. A normal TCP socket is connected to IP address and port. WiFiServer starts a listening socket on a port. If server on listening socket is contacted by a remote client socket, it creates a local socket connected with the remote client socket on a free port and returns a WiFiClient object wrapping the socket. Everything you write or print to a WiFiClient is send to that one remote socket.
If one of your client boards creates a WiFiClient and connects it to IP address and port of the WiFiServer on your 'server' board, then you get there a WiFiClient from server.available() and this two WiFiClient objects are connected. What you write/print on one side you read only from the WiFiClient object on the other side.
client socket
if (client.connect(serverIP, PORT)) {
  client.print("request\n");
  String response = client.readStringUntil('\n');
  Serial.println(response);
  client.stop();
}

server side
WiFiClient client = server.available();
if (client && client.connected()) {
  String request = client.readStringUntil('\n');
  Serial.println(request);
  client.print("response\n");
  client.stop();
}


user61512: I found a tutorial that explains exactly what Majenko and Juraj explained,
https://www.instructables.com/id/MKR1000-IoT-Clientserver-Communications/
the library code that the tutorial references is useful, the tutorial is useful to us learning communication

61512: <p>I want to simply send data from one MKR1000 to the other over wifi, both are connected to the same network, but sending the data is where I get stuck, I've looked through tuts everywhere but can't seem to find an answer.. can someone point me to a solution?</p>

<p>I've set up my devices using the tut <a href="https://www.arduino.cc/en/Tutorial/Wifi101WiFiChatServer" rel="nofollow noreferrer">https://www.arduino.cc/en/Tutorial/Wifi101WiFiChatServer</a>
but the devices don't communicate to each other they only take telnet from the host server(my laptops wifi hotspot)</p>
 37622: <p>WiFiClient object wraps a TCP socket. A normal TCP socket is connected to IP address and port. WiFiServer starts a listening socket on a port. If server on listening socket is contacted by a remote client socket, it creates a local socket connected with the remote client socket on a free port and returns a WiFiClient object wrapping the socket. Everything you write or print to a WiFiClient is send to that one remote socket.</p>

<p>If one of your client boards creates a WiFiClient and connects it to IP address and port of the WiFiServer on your 'server' board, then you get there a WiFiClient from server.available() and this two WiFiClient objects are connected. What you write/print on one side you read only from the WiFiClient object on the other side.</p>

<p>client socket</p>

<pre><code>if (client.connect(serverIP, PORT)) {
  client.print("request\n");
  String response = client.readStringUntil('\n');
  Serial.println(response);
  client.stop();
}
</code></pre>

<p>server side</p>

<pre><code>WiFiClient client = server.available();
if (client &amp;&amp; client.connected()) {
  String request = client.readStringUntil('\n');
  Serial.println(request);
  client.print("response\n");
  client.stop();
}
</code></pre>
 61512: <p>I found a tutorial that explains exactly what <a href="https://arduino.stackexchange.com/users/4143/majenko">Majenko</a> and <a href="https://arduino.stackexchange.com/users/37622/juraj">Juraj</a> explained,
<a href="https://www.instructables.com/id/MKR1000-IoT-Clientserver-Communications/" rel="nofollow noreferrer">https://www.instructables.com/id/MKR1000-IoT-Clientserver-Communications/</a></p>

<p>the library code that the tutorial references is useful, the tutorial is useful to us learning communication</p>
