0

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 :)

  • 1
    Use 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 Dec 25 '17 at 15:24
  • @tttapa: you mean ENC28J60 is useless here ? – Safa Seed Dec 25 '17 at 15:25
  • 2
    No, 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 Dec 25 '17 at 15:28
  • github.com/ntruchsess/arduino_uip/tree/master/examples found this on github. I think its what youre talking about. – Safa Seed Dec 25 '17 at 20:34
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:

https://stackoverflow.com/questions/20038943/simple-udp-example-to-send-and-receive-data-from-same-socket

and

https://stackoverflow.com/questions/10182751/server-client-send-receive-simple-text

  • The netcat/ncat/nmap familiy of tools is also handy for those tests. They run in Linux and Windows. – user31481 Dec 26 '17 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.