Arduino Yun YunClient

I would send a TCP-messages from man Arduino Yun ver1 to my IP-Ninjar CTB. It took a while before I understand ther was a webinterface to set my fixed IP. :frowning:

I understand that Arduino Yun don´t use same communication as other Arduino ethernet-shields, that is why I don´t use <Ethernet.h> and try to use <YunClient.h> instead...

My simple code...

#include <Bridge.h>
#include <YunClient.h>

byte mac[] { 0xB4, 0x21, 0x8A, 0xF8, 0x40, 0x3B }; //My MAC-adress...
IPAdress SDVoE_IP(10, 101, 201, 9);
const int SDVoE_port = 1100;

YunClient client;

void setup() {
    Bridge.begin();
}

void loop() {
    client.connect(SDVoE_IP, SDVoE_Port);
    client.write('@SSV,0,0,1,1,101');
    client.flush();
    client.stop(); 
    delay(15000);
}

So, i would send "@SSV,0,0,1,1,101" to 10.101.201.9:1100 and wait 15sec and resend it. But when i check with Wireshark nothings sends out from man Yun on the Network. I had terminate the WIFI and would only use my coppar-cable for this project

What have I missed? Is ther a guide that esplain how to send a easy text on TCP for Arduino Yun. Found couple of code, but nothing works for me. :frowning:

I had intended to do this with a Raspberry Pi, but these are unobtainable. So that's why I'm trying the Arduino Yun instead. In the end I should try to build a bridge between Open Sound Control and IDK IP-Ninjar.

First - the single quotes in C are used for a single char only, you should write your string as:
"@SSV,0,0,1,1,101"

and next - the write() method with single parameter can be used again for single char only!

It seems like you get the example from the net, where write() was used for single char and than edited it without understanding.

Try this:

const char* message = "@SSV,0,0,1,1,101";
client.write((message, strlen(message));

Thanks b707... I jump between a lots of programinglanguage and probably figure it out later when I see it start sending my packages on my network. :slight_smile:

Now I tried out more...

if(client.connect(SDVOE_IP, SDVoE_PORT)) {Serial.println("Connected to server...")}

It says I'am connected to server, but it dosen´t matter if I are connected to my switch or not... I still cant figure it out how to send TCP-messages out on my network. :frowning:

Have also try <BridgeClient.h> and go back to <Ethernet.h>.. and retry with <YunClient.h>. Still nothing on my network.

It seems like you didn't understand me.
Without fixing this errors your code will send nothing .

If it´s says I'am connected to my server, with or whitout my networkcable I probably got something more fault and miss something in my code, to get the right connection via my Arduino-code and Linux-part to my CTB-server. :man_shrugging:

I try to change to your code, but i still don´t see my TCP-package with Wireshark on the network. No other error in my code... and no more ideas. :frowning:

I change to a new Arduino Yun rev 2 and it work. :slight_smile:

Thanks b707 for the information about ' and "...