Hi, I am working on a device with the W6100 chip and having some issues with connecting to a TCP Client.
I have followed the documenation directly https://wizwiki.net/wiki/lib/exe/fetch.php/products:w6100:w6100_ds_v104e.pdf
and nothing was happening, then I found some examples for W5500 that showed that you have to run OPEN command after setting the destination address and port.
Then something start working, I got some messages in wireshark:
But it still doesn’t stay connected, on the server side I am using just plain nc and it throws an error:
Listening on 0.0.0.0 5000
nc: accept: Software caused connection abort
I am missing something after doing connect?
struct eth_socket_mode mode = {
.multi = 0,
.broadcast = 0,
.noackdelay = 0,
.unicast = 0,
.protocol = ETH_SOCKET_MODE_PROTOCOL_TCP4,
};
ETH_WRITE_SOCKET_CONF(priv->dev, priv->number, ETH_SOCKET_MODE, &mode, sizeof(mode));
ETH_WRITE_SOCKET_CONF(priv->dev, priv->number, ETH_SOCKET_DEST4, &parsed_ip, sizeof(parsed_ip));
ETH_WRITE_SOCKET_CONF(priv->dev, priv->number, ETH_SOCKET_PORT, &parsed_port, sizeof(parsed_port));
uint8_t command = ETH_SOCKET_COMMAND_OPEN;
ETH_WRITE_SOCKET_CONF(priv->dev, priv->number, ETH_SOCKET_COMMAND, &command, sizeof(command));
uint64_t start = tools_get_current_ms();
do {
msleep(5);
ETH_READ_SOCKET_CONF(priv->dev, priv->number, ETH_SOCKET_COMMAND, &command, sizeof(command));
_info("command: %d\n", command);
} while (command != 0 && tools_get_current_ms() - start < priv->timeout);
command = ETH_SOCKET_COMMAND_CONNECT;
ETH_WRITE_SOCKET_CONF(priv->dev, priv->number, ETH_SOCKET_COMMAND, &command, sizeof(command));
start = tools_get_current_ms();
do {
msleep(5);
ETH_READ_SOCKET_CONF(priv->dev, priv->number, ETH_SOCKET_COMMAND, &command, sizeof(command));
_info("command: %d\n", command);
} while (command != 0 && tools_get_current_ms() - start < priv->timeout);
Here is my code for opening TCP Connection. Any one can help me with that?