0

Using the ifaddrs API, i was able to detect different interfaces like eth0(for ethernet)/wlan0(for wireless)/ ppp0(for cellular).

I have read this discussion for android : Detect network connection type on Android

Whether similar to these things available in C/unix programming? i.e. can i able to differentiate different cellular interfaces using c program in unix?

Community
  • 1
  • 1
prashant
  • 59
  • 7

2 Answers2

0

This sort of operation is going to be 100% system-dependent, and handling of network devices is notoriously variable and ad hoc on Unix systems (e.g., sometimes they're in /dev, sometimes not). There doesn't appear to be a standardized cross-platform library for handling the issue. If you're going to be running on Linux, you may be able to ask NetworkManager for interface information.

See also Detect network connection type in Linux

Community
  • 1
  • 1
chrylis -cautiouslyoptimistic-
  • 75,269
  • 21
  • 115
  • 152
0

If you're using a cell modem, you could query it directly by sending it AT-commands through serial port (Tx, Rx, Grnd). The cell modem's reference should have the command you need to detect its current connection type (e.g. if its SIM900D cell modem, search for SIM900D AT REFERENCE GUIDE). You'll need to know what level the cell modem is operating on, e.g. TTL voltage level, and buy the right serial interface chip (e.g. here's USB to serial https://www.sparkfun.com/products/9019) to send the AT-commands to it and receive the output.

Evgheni Crujcov
  • 470
  • 2
  • 8