The TCP socket connection based on enc28j60 chip for arduino 1.0
View the Project on GitHub dovrose/Socket-network-for-enc28j60---arduino
I had to create a project with TCP/IP socket connection. All other projects I found was a connection to Web sites, but the link was dropped after the connection. I added the ability to keep the connection open, but I didn't tried to connect to WEB pages (I don't need it).
ENC28J60 Ethernet Module utilizes the new Microchip ENC28J60 Stand-Alone Ethernet Controller IC featuring a host of features to handle most of the network protocol requirements. The board connects directly to most microcontrollers with a standard SPI interface with a transfer speed of up to 20MHz.
We can do the following:
static uint8_t mymac[6] = {0x54,0x55,0x58,0x10,0x00,0x24};
static uint16_t my_port = 11200; // client port
static uint16_t server_port = 1000; // server port
static uint8_t dest_ip[4]={192,168,1,105}; //server IP
net.socketSetup(tcpSerialPrint,my_port,dest_ip,server_port);
the tcpSerialPrint is callback function on receiving data.
while (!net.connect()) {}
Serial.println("socket connected");
net.process();
net.available()
To create this, I had help from the following: