Go Down

Topic: Yun TCP IP (Read 255 times) previous topic - next topic


Hello everyone, I need some help for my project. I am trying to connect my Arduino Yun with my PC via TCP connection. I have developed a simple C# app that sends and receives data over TCP, tested it and it works. Now, I am trying to write a code for my Yun, to communicate with my PC. Here is my code:

Code: [Select]

#include <Bridge.h>
#include <BridgeServer.h>
#include <BridgeClient.h>

BridgeServer server(23);

boolean alreadyConnected = false;

void setup() {



void loop() {

  BridgeClient client = server.accept(); 

  if (client) {
    if (!alreadyConnected) {
      // clead out the input buffer:
      Serial.println("We have a new client");
      client.println("Hello, client!");
      alreadyConnected = true;

    if (client.available() > 0) {
      // read the bytes incoming from the client:
      char thisChar = client.read();
      // echo the bytes back to the client:
      // echo the bytes to the server as well:

As you can see, it is a very simple code, almost the same as the Ethernet Chat Server example. I have tried to communicate with my PC and it doesn't worked. First I thought that my C# app doesn't works, but it works fine.

After that, I downloaded the SocketTest v3 software, and tried to communicate with my Yun. When I connects to the Yun, it sends me back the message: "Hello client" and it writes to the serial monitor: "We have a new client" but it doesn't responds to any other message.

Any suggestion? What am I doing wrong?

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131