I´m new to andruino but get two boards working very well. One is a MEGA88 custom board and the second one is the Pollin NET IO Board with Mega 644p and ENC28j60 Network Chip.
I can run the EtherCard Sample like Ping or RBBBServer and it works very well.
But I´m searching for a very basic sample to implement a TCP Server. I have a TCP client written in C# which should connect to the server. Then the server should send every Second a data package with some sensor data to the connected client.
The EtherCard Example folder has no TCP Server sample (or I haven´t found it right now).
So is there anyone you can give me a small example how to get this working?
the second one is the Pollin NET IO Board with Mega 644p and ENC28j60 Network Chip
As you haven't provided any links to this product I used Google to find it. On the found page there is nothing that sounds like an Arduino, just Microsoft .NET is mentioned. This thing doesn't seem to have an Arduino bootloader on it so you must go a bit more in to detail and link your used software or the libraries you wanna use to allow us to get a sense of what environment you're talking about.
It´s a very cheap Mega32 board with an ENC28J60 chip attached. It has no preinstalled Arduino Bootloader.
To get it working with Arduino I used the bootlader from here: http://sanguino.cc/
I changed the mega to a 644P to have more RAM and Flash.
There are also some sanguino files available to get the 644p working correctly with the Arduino IDE.
The board is working nice with that bootloader and Arduino 1.0.3. I got the demos like blink working and I got also the ping demo running from ethercard.
The rbbb_server runs also fine on that board.
What I need is to create a very simple TCP Server with the EtherCard library. I want to connect to that TCP server from a C# application. The connection should be available until the client disconnects. And if there is a connection I simply want to send some data to the connected client.
What I need is to create a very simple TCP Server with the EtherCard library.
Don't expect that to be as simple as with the Ethernet library for the WizNet shields. The rbbb_server example shows you more or less, how that works. The response there is a HTTP response but it could be anything. From a quick overview I would say that it doesn't even check for the port the packet is arriving on, the response is always HTTP. The same way you can send any data you like. The EtherCard library is a very raw library for that purpose. You have much control over the low level stuff but no high level interface. To program it, you should have an in-depth look at the TCP/IP protocol because you have to do that yourself (although with the support of some helper routines), you must know what a SYN or ACK flag is and how the handshake in TCP works.