I'm working on an Arduino project that sends and receives text to/from a C# application via ENC28J60 in a LAN network. Whenever C# sends a request to Arduino (In text), Arduino responds to it by sending also a text. What is the best way to do this? I'm newbie in network programming (Or whatever it's called). Thanls in advance :)
-
1Use a TCP socket. Give the Arduino a static IP address, run a TCP server, and have the C# application open the connection as a TCP client.tttapa– tttapa2017年12月25日 15:24:21 +00:00Commented Dec 25, 2017 at 15:24
-
@tttapa: you mean ENC28J60 is useless here ?Safa Dana– Safa Dana2017年12月25日 15:25:26 +00:00Commented Dec 25, 2017 at 15:25
-
2No, you need the ENC28J60 to connect the Arduino to the LAN. TCP is a network protocol that works on top of the physical connection that's established by the ENC. This could be useful (it was written for the ESP8266, a WiFi chip for Arduino, but the principle is the same.tttapa– tttapa2017年12月25日 15:28:56 +00:00Commented Dec 25, 2017 at 15:28
-
github.com/ntruchsess/arduino_uip/tree/master/examples found this on github. I think its what youre talking about.Safa Dana– Safa Dana2017年12月25日 20:34:01 +00:00Commented Dec 25, 2017 at 20:34
1 Answer 1
You can use TCP or UDP protocols.
https://www.arduino.cc/en/Tutorial/UDPSendReceiveString
https://www.arduino.cc/en/Tutorial/DhcpChatServer
You can use free UDP, TCP port listener sofwares for Windows, Linux etc.. for testing your setup.
For C# development:
and
https://stackoverflow.com/questions/10182751/server-client-send-receive-simple-text
-
1The netcat/ncat/nmap familiy of tools is also handy for those tests. They run in Linux and Windows.user31481– user314812017年12月26日 08:38:32 +00:00Commented Dec 26, 2017 at 8:38