I am using w5100 Ethernet shield with STM32L476 Nucleo board.
I have following flow which fails at 5th operation, Can anyone help in figuring out what could be wrong in my operation.
1. Create Socket
socketNumber = socket(0, Sn_MR_TCP, portNo, SF_TCP_NODELAY);
socket() created socket number = 0
socket create return val = 1
2. Send data on Socket
socket number = 0 & numBytesToWrite = 132
retValue = send(socketNumber, (uint8_t *)pBuffer, numBytesToWrite);
send retValue = 132
3. Read data on Socket
socket number = 0 & maxBytesToRead = 2048
retValue = recv(socket, (uint8_t *)pBuffer, maxBytesToRead);
read bytes retValue = 1950
4. Send data on Socket
socket number = 0 & numBytesToWrite = 267
retValue = send(socketNumber, (uint8_t *)pBuffer, numBytesToWrite);
send retValue = 267
5. Send data on Socket
socket number = 0 & numBytesToWrite = 6
retValue = send(socketNumber, (uint8_t *)pBuffer, numBytesToWrite);
send retValue = -7
#define SOCKERR_SOCKSTATUS (SOCK_ERROR - 7) ///< Invalid socket status for socket operation.
What could be that it is returning SOCKERR_SOCKSTATUS error.
So for some reason socket is being closed when you try to send more data.
I can only guess what is going on; for example, if you use HTTP protocol, you may be sending wrong data during your step 4, and remote host closes the connection.
I propose you looking at what is going on the network using Wireshark to see what is actually being sent, and check the sequence of packets.
If you wish you can capture network activity log using Wireshark, and share it here so that we can have a look.
Currently I don’t have any blocker, as my application has lot of transaction with multiple socket on server so I was thinking to have each transaction in blocking mode which can confirm each operation done synchronously.
I can see that other chips like 5500 has flag SF_IPv6_BLOCK so thought if needed to 5100 then how I can implement same.