This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf52840 gsm modem sim800 tcp client socket send error

Hi,

I created an example using gsm_modem application, after network connected, I create tcp client socket then send data to the server. After several sendings, I got the packet allocation failed.

char buff[10] = "abcdef\n";
int len = sizeof(buff);

// ... after network connected in main function

int sockfd, connfd;
struct sockaddr_in servaddr, cli;
  
// socket create and varification
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd == -1) {
    printk("socket creation failed...\n");
    return;
}

printk("Socket successfully created..\n");

int  IP = 104*256*256*256 + 168*256*256 + 98*256 + 15;   // 104.168.98.15

// assign IP, PORT
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = htonl(IP);
servaddr.sin_port = htons(2120);

// connect the client socket to server socket
if (connect(sockfd, (struct sockaddr_in*) & servaddr, sizeof(servaddr)) != 0)
{
    printk("connection with the server failed...\n");
    return;
}

printk("connected to the server..\n");

while (1) 
{
    send(sockfd, buff, 10, 0);
    k_sleep(K_SECONDS(2));
}


Error log:
[00:00:29.692,749] [1;31m<err> net_tcp: conn: 0x200133c0 packet allocation failed, len=10[0m
[00:00:29.892,944] [1;31m<err> net_tcp: conn: 0x200133c0 packet allocation failed, len=10[0m
[00:00:30.093,139] [1;31m<err> net_tcp: conn: 0x200133c0 packet allocation failed, len=10[0m
[00:00:30.293,334] [1;31m<err> net_tcp: conn: 0x200133c0 packet allocation failed, len=10[0m
[00:00:30.493,530] [1;31m<err> net_tcp: conn: 0x200133c0 packet allocation failed, len=10[0m
[00:00:30.693,725] [1;31m<err> net_tcp: conn: 0x200133c0 packet allocation failed, len=10[0m
[00:00:30.893,920] [1;31m<err> net_tcp: conn: 0x200133c0 packet allocation failed, len=10[0m
[00:00:31.094,116] [1;31m<err> net_tcp: conn: 0x200133c0 packet allocation failed, len=10[0m
[00:00:31.294,311] [1;31m<err> net_tcp: conn: 0x200133c0 packet allocation failed, len=10[0m
[00:00:31.494,506] [1;31m<err> net_tcp: conn: 0x200133c0 packet allocation failed, len=10[0m
[00:00:31.694,702] [1;31m<err> net_tcp: conn: 0x200133c0 packet allocation failed, len=10[0m

Do you know how to fix this issue?
Thanks.

Parents Reply Children
No Data
Related