| 88 | } |
| 89 | |
| 90 | static void check_network_status(void) |
| 91 | { |
| 92 | LOG_I("Checking network device status..."); |
| 93 | |
| 94 | /* Try to create a simple socket to test network availability */ |
| 95 | int test_sock = sal_socket(AF_INET, SOCK_STREAM, 0); |
| 96 | if (test_sock < 0) |
| 97 | { |
| 98 | LOG_E("Network test socket creation failed: %d", test_sock); |
| 99 | LOG_E("Network device or protocol family issue detected"); |
| 100 | return; |
| 101 | } |
| 102 | |
| 103 | LOG_I("Network test socket created successfully: %d", test_sock); |
| 104 | sal_closesocket(test_sock); |
| 105 | |
| 106 | /* Fallback to loopback; dynamic IP via netdev may not be available */ |
| 107 | safe_strcpy(local_ip, "127.0.0.1", sizeof(local_ip)); |
| 108 | LOG_I("Using loopback IP address for testing: %s", local_ip); |
| 109 | |
| 110 | LOG_I("Network device appears operational"); |
| 111 | } |
| 112 | |
| 113 | static int set_socket_timeout(int sock, int timeout_ms) |
| 114 | { |
no test coverage detected