Project

General

Profile

Ethercard library, send string via tcp

Added by muelli almost 6 years ago

Hello forum,

I am using the ethercard library with an arduino uno.
I tried the examples that came with the library, staticIP, ping tests etc work quite well.
Now I have two problems:
1. DHCP does not work. My dhcp server sees the DHCPDISCOVER on the interface, it responds with a DHCPOFFER but the client does not DHCPACK:

May 7 17:19:58 server dhcpd: DHCPDISCOVER from 74:69:69:2d:30:31 via eth0
May 7 17:19:58 server dhcpd: DHCPOFFER on 192.168.117.54 to 74:69:69:2d:30:31 via eth0
May 7 17:20:08 server dhcpd: DHCPDISCOVER from 74:69:69:2d:30:31 via eth0
May 7 17:20:08 server dhcpd: DHCPOFFER on 192.168.117.54 to 74:69:69:2d:30:31 via eth0
May 7 17:21:18 server dhcpd: DHCPDISCOVER from 74:69:69:2d:30:31 via eth0
May 7 17:21:18 server dhcpd: DHCPOFFER on 192.168.117.54 to 74:69:69:2d:30:31 via eth0
May 7 17:21:28 server dhcpd: DHCPDISCOVER from 74:69:69:2d:30:31 via eth0
May 7 17:21:28 server dhcpd: DHCPOFFER on 192.168.117.54 to 74:69:69:2d:30:31 via eth0
[…]

Sometimes if I reset the arduino several times in a row, I can see a DHCPACK but the IP is not logged to the serial monitor.
Could this be a timing problem? DHCP server responding to fast?

  1. How can I send a string via tcp to an IP address and specified port? For example I start a tcp listening netcat on my server on port 555: ‘netcat -l -p 555’ I tried to create a sketch based on the examples but I fail. The init seems to work, I can set up a fixed IP, the gateway is found (I can see the ARP request on the interface on the gateway) but ether.tcpSend() does not seem to send anything. I must admint, I am a bit confused with the “Stash” in the examples….

I hope someone has an idea!
thanks and kind regards
Stefan