Sending data between two arduino yun via wifi

Thank you a lot! your hint really helped me :slight_smile: i managed it to connect with the server, but an other problem popped up.
How can i write and read data from an client? it just doesn't work with client.write() and client.read()
This is my code:
Client:

void loop() {
  YunClient client;
  if(client.connect(server,5555)){
      //Console.println(analogRead(A0));
      client.write(42);
  }
  client.stop();
  delay(500);
}

Server:

YunClient client = server.accept();
  if(client){
   [color=red] Console.println(client.read()); // this should print out 42[/color]
    digitalWrite(13,HIGH);
    delay(100);
    digitalWrite(13,LOW);
    client.stop();
  }

The problem is the red line in the code. It should print out 42, but it only prints -1 (no byte available). Can somebody tell me what i did wrong?

Thanks in advance