API Reference | developer.brewmp.com API Reference | developer.brewmp.com


API Reference


Brew Release
Brew MP 1.0.2
See Also
The INetMgr Interface functions provide mechanisms to get and set the parameters associated with the network subsystem of the device. It also provides means to create multiple ISocket interfaces that use TCP or UDP to transmit and receive data over the network.
In new Brew versions, INetwork, IAddrInfo, IAddrInfoCache and INetUtils replace INetMgr and are recommended for use.
NOTE: Your application must have a privilege level of Network or All to invoke the functions in this interface.
INETMGR_OpenSocket() opens a TCP or UDP socket. If successful, this function returns a pointer to an instance of the ISocket Interface. When required the BREW AEE brings up the network subsystem. The subsystem components include:
- CDMA physical layer,

- Radio Link Protocol (RLP) for CDMA devices

- Point-to-Point Protocol (PPP) connections.

These connections are shared by all of the device's sockets. You close a socket by calling ISOCKET_Release(). When the last socket on the device is closed, the BREW AEE terminates the network subsystem connections after a specified linger time.
INETMGR_GetHostByName() takes as input the name of a host (for example, brew.qualcomm.com) and returns a list of IP addresses that can be used to access that host. Because retrieving this list requires network communication, INETMGR_GetHostByName() is asynchronous. You specify the AEECallback input parameter, and the specified function is called when the IP address list is available.
INETMGR_GetMyIPAddr() returns the device's own IP address.
INETMGR_NetStatus() returns the current status (opening, open, closing, or closed) of the device's PPP connection and some statistics on the current performance of the network subsystem.
INETMGR_SetLinger() sets the linger time of the PPP connection. This is the amount of time that the BREW AEE waits to terminate the PPP connection after the device's last connected socket is closed (the default value is 30 seconds).
INETMGR_GetLastError() returns information about the last error detected in executing INETMGR_OpenSocket(). When INETMGR_OpenSocket() returns something other than success, INETMGR_GetLastError() provides more detailed information about why the function failed to perform its task.
To use the functions in the INetMgr Interface 1. Call ISHELL_CreateInstance() to create an instance of the INetMgr Interface. 2. Use the following functions in the INetMgr Interface as needed:

– To obtain remote or local IP address information, call INETMGR_GetHostByName() or INETMGR_GetMyIPAddr(). – To obtain PPP connection status, call INETMGR_NetStatus(). – To set the PPP linger time, call INETMGR_SetLinger().
To set up a TCP or UDP socket and transfer data over it 1. Call INETMGR_OpenSocket() to open the socket. 2. For TCP using the pointer returned by INETMGR_OpenSocket(), call ISOCKET_Connect() to connect the socket to the specified destination address. 3. Use functions in the ISocket to read and write data on the connection. 4. Call ISOCKET_Release() to close the connection when you have completed the necessary exchange of data. 5. Call INETMGR_Release() when you no longer need the INetMgr Interface instance.