SurferTim:
That is client code. The server runs on the other device.
That is correct. But I am not running anything on other device.
Ok here is bigger picture,
I have ethernet switch. I connected (2 devices) a arduino due and a Yun to the ethernet switch. The server address is ethernet IP address of Yun. But currently on Yun i have not uploaded a sketch. It's just having a blink LED sketch. Whereas on the Due I am running above simple commands, and client.connect is always returning true even though there is no server running right now on Yun.
So that's why I am unable to figure out why it's returning true always ?
SurferTim:
Are you certain there is no telnet server running on the Yun?
Ok so here is the testing procedure:
First I run the telnet server program on Yun.
Now the client.connect returns true value - (This is fine) (On Due)
Now I run the blink led program on yun.
But now still client.connect returns true value. (Which is wrong or I don't want ) (On Due)
Is there something I am missing ? I mean even though I over written the sketch on Yun, will the telnet server be running in background once it was started due to the previous code?
If yes, then how can I stop it ? Is there any command I need to run to stop the server ?
swaroop2011:
Is there something I am missing ? I mean even though I over written the sketch on Yun, will the telnet server be running in background once it was started due to the previous code?
The Yun is (essentially) two devices on a single board, connected by an internal software 'bridge'. On one side of the bridge, you have an Atheros 'System on Chip' running a Linux distribution. On the other side of the bridge is an Arduino Leonardo, running an Arduino 'sketch.' Uploading a new sketch has no effect on the Linux side of the bridge.
If yes, then how can I stop it ? Is there any command I need to run to stop the server ?
The Telnet daemon is Linux! There are a number of ways to stop a daemon service starting up in Linux. Probably the easiest on the Yun is to disable the service through the Luci web configurator.
You might get more help in the Yun specific forum. Especially with the Linux-ness.
SurferTim:
So the telnet server is running on the Yun? If so, what is the problem? The Due is connecting as a client to the Yun's telnet server.
The problem is, I have started the server on yun first by uploading server code. Then I overwrite it by uploading blink-Led sketch. So i thought that server won't exist anymore now. But as
MattS-UK:
The Yun is (essentially) two devices on a single board, connected by an internal software 'bridge'. On one side of the bridge, you have an Atheros 'System on Chip' running a Linux distribution. On the other side of the bridge is an Arduino Leonardo, running an Arduino 'sketch.' Uploading a new sketch has no effect on the Linux side of the bridge.
I believe uploading new sketch is not having any effect on linux side operations.
Then I need a way to stop the server by using some command in the code ?
christop:
Client.connect() does not return true or false. It returns an integer indicating success or error:
SUCCESS 1
TIMED_OUT -1
INVALID_SERVER -2
TRUNCATED -3
INVALID_RESPONSE -4
All of those integer return values are considered "true" inside an "if" statement because they are non-zero.
I even tried if(client.connect(server,23) == 1) , so it was always returning 1.
So if anyone has any ideas how to stop the server on linux part of yun will be helpful. As Matt suggested i will post this particular thing in Yun forum.