<Environment>
- Windows10
- nrf v1.3.0
- modem fw 1.2.0
I'm attempting to make a socket and communicate with the modem using it.
However, sending data doesn't work out. It was working in v1.2.0. Any tip?
I don't want to use at_cmd.c becuase I need a exclusive socket for SMS notification.
<main.c>
#include <zephyr.h> #include <stdio.h> #include <net/socket.h> #include <modem/lte_lc.h> #define BUF_LEN 128 int fd; void main(){ int ret; char at_cmd[] = "AT\n"; char buf[BUF_LEN]; /* Configure LTE-M */ printk("LTE Link Connecting ...\n"); ret = lte_lc_init_and_connect(); printk("LTE Link Connected!\n"); if (ret) { printk("Error: modem_configure\n"); return; } /* SMS socket set up*/ fd = socket(AF_LTE, 0, NPROTO_AT); /* init fd */ if (fd == -1) { return; } // Send AT command => ERROR !! if (send(fd, at_cmd, strlen(at_cmd), 0) <= 0) { printk("Error: send\n"); return; } // blocking receive if (recv(fd, buf, BUF_LEN, MSG_DONTWAIT) <= 0) { printk("Error: send\n"); return; } printk("Socket works out!\n"); return; }