Can Arduino (211.211.211.0) send Thermometer(input) information to the receiver directly over TCP/IP ?
Yes, an Arduino can make a connection to any other device on the internet which is not behind a firewall or NAT router.
In the latter 2 cases you need to setup some tunnel or use an intermediate server on the internet.
Can Arduino (211.211.211.0) send Thermometer(input) information to the receiver directly over TCP/IP ?
Yes, an Arduino can make a connection to any other device on the internet which is not behind a firewall or NAT router.
In the latter 2 cases you need to setup some tunnel or use an intermediate server on the internet.
Thanks for your comment. I have a question for the intermediate server. The Arduino with IP will keep listening whether main server sends information or not. Every time it receives commands from server, it will change sketches. For example, Arduino has a paramenter, time. Server sends 'String 30mins'. Once Arduino receives the string, it only sends Temp data every 30mins. Is that possible?
The Arduino with IP will keep listening whether main server sends information or not.
Main server? If the Arduino is a server, and client can connect to it, and send it information. If the Arduino is a client, it can only connect to one server, and PULL information from the server.
So, which way is your Arduino (to be) set up?
Every time it receives commands from server, it will change sketches.
Not possible.
For example, Arduino has a paramenter, time. Server sends 'String 30mins'. Once Arduino receives the string, it only sends Temp data every 30mins. Is that possible?
Yes and no. Making the Arduino behave differently based on input that it receives is possible.
But, if the Arduino is a server, then it can not push new information anywhere, as it has no idea where to push it. It is up to the client to request new information as required.
If the Arduino is a client, then it can make a request to a server on whatever schedule you require. During that request, it can supply whatever information is required to satisfy that request. So, it can request that the server store some data, and can supply that data.
It is no different from any two other computers talking to each other.
The Arduino with IP will keep listening whether main server sends information or not.
Main server? If the Arduino is a server, and client can connect to it, and send it information. If the Arduino is a client, it can only connect to one server, and PULL information from the server.
So, which way is your Arduino (to be) set up?
It will be a client
Every time it receives commands from server, it will change sketches.
Not possible.
For example, Arduino has a paramenter, time. Server sends 'String 30mins'. Once Arduino receives the string, it only sends Temp data every 30mins. Is that possible?
Yes and no. Making the Arduino behave differently based on input that it receives is possible.
But, if the Arduino is a server, then it can not push new information anywhere, as it has no idea where to push it. It is up to the client to request new information as required.
If the Arduino is a client, then it can make a request to a server on whatever schedule you require. During that request, it can supply whatever information is required to satisfy that request. So, it can request that the server store some data, and can supply that data.
It is no different from any two other computers talking to each other.
I see, thanks. Arudino will be a client. Client does not need to send a request. But Server will send a request to the Arduino(client). Based on the request, Arduino just follows the request to send data from inputs to server or make a command to outputs
I see, thanks. Arudino will be a client. Client does not need to send a request. But Server will send a request to the Arduino(client). Based on the request, Arduino just follows the request to send data from inputs to server or make a command to outputs
I think you have a fundamental misunderstanding of client/server architecture.
Servers do not initiate transactions. Clients do. If the Arduino is a client, it can initiate transactions. These can include transactions that provide information to a server. The server, though, can not then send any data to the Arduino.
Imagine google periodically sending information to your computer, because you had once asked that server for information. The backlash would tank google's stock overnight.
I think you need to either plan to have the Arduino act as a server, and have some client poll it for information on a regular basis, or have the Arduino act as a client, and have it ask the server how often to ask it to save data. The Arduino does not normally act as both client and server to some other computer playing both client and server.
I see, thanks. Arudino will be a client. Client does not need to send a request. But Server will send a request to the Arduino(client). Based on the request, Arduino just follows the request to send data from inputs to server or make a command to outputs
I think you have a fundamental misunderstanding of client/server architecture.
Servers do not initiate transactions. Clients do. If the Arduino is a client, it can initiate transactions. These can include transactions that provide information to a server. The server, though, can not then send any data to the Arduino.
Imagine google periodically sending information to your computer, because you had once asked that server for information. The backlash would tank google's stock overnight.
I think you need to either plan to have the Arduino act as a server, and have some client poll it for information on a regular basis, or have the Arduino act as a client, and have it ask the server how often to ask it to save data. The Arduino does not normally act as both client and server to some other computer playing both client and server.
Thanks again.
Assuming that I set up Arduino as a server, some clients request the Arduino server send temp data. Every time the Arduino receives the requests, it sends temp data to the clients. So, clients can change the request period whenever they want (on time-schedule, they just request).
If Arduino is a client, it initiates the request to a server and sends data every 30mins, for example. However, server cannot send data to Arduino to change setups. To do it, it is needed to change sketches inside Arduino.
If Arduino is a client, it initiates the request to a server and sends data every 30mins, for example. However, server cannot send data to Arduino to change setups. To do it, it is needed to change sketches inside Arduino.
Is that right?
Yes, and no.
The Arduino could make two kinds of GET requests, like:
GET ./getInterval.php
GET ./saveValues.php?temp=17.6&rh=45.9
For each get request made, the server executes some code to generate a response, which the Arduino should read.
The getInterval.php script could return something like:
Interval: 30
The saveValues.php script could return something like:
Success
or:
Failure
The Arduino should be able to distinguish between the 3 return phrases, and extract relevant data from them (if any), and use that data for it's own purposes.
If Arduino is a client, it initiates the request to a server and sends data every 30mins, for example. However, server cannot send data to Arduino to change setups. To do it, it is needed to change sketches inside Arduino.
Is that right?
Yes, and no.
The Arduino could make two kinds of GET requests, like:
GET ./getInterval.php
GET ./saveValues.php?temp=17.6&rh=45.9
For each get request made, the server executes some code to generate a response, which the Arduino should read.
The getInterval.php script could return something like:
Interval: 30
The saveValues.php script could return something like:
Success
or:
Failure
The Arduino should be able to distinguish between the 3 return phrases, and extract relevant data from them (if any), and use that data for it's own purposes.
Good!!
I have been thinking that we may use Arduino as ChatServer/ChatClient, not WebServer/WebClient.
Once again, I mentioned earlier that Arduino needs to communicate with others as a server or client.
If we set up Arduino as a server, it keeps listening a port for a chat with clients.
Once it establishes a connection, they can communicate each other.
If Client says that "Sends Temp data" or "Turn on TV", the Arduino sever first sees the message and follows the commands.
It is able to send Temp data as a String message and turn off TV using IR remote controller wired to Arduino.
Then it disconnects the connection and waits again.