How to check the status of my sockets and PPP connection?
Submitted by: AdministratorWe can check on the status of the PPP connection (active, inactive, opening or closing) using INETMGR_NetStatus().
NetState netState = NET_INVALID_STATE;
AEENetStats netStats;
netState = INETMGR_NetStatus (pINetMgr, &netStats);
We can use INETMGR_OnEvent() to monitor both the status of the PPP connection and socket connections. Refer to NetMgrEvent enum in AEENet.h for a list of all network and socket events.
// Register to receive Network and Socket events
INETMGR_OnEvent(piNet, (PFNNETMGREVENT)CheckNetStatus,
(void*)pMe, TRUE);
//Callback invoked when Network/Socket event is received
static void CheckNetStatus(void* cxt,
NetMgrEvent evt, uint32 dwData) {
SampleApp *pMe = (SampleApp*)cxt;
if(evt == NE_PPP) {
// network event. dwData = NetState enum value
// refer NetState data structure in BREW API Reference doc
}
if(evt == NE_SO_CLOSING || evt == NE_SO_CLOSED) {
// socket event - closing or closed.
// DwData is pointer to socket
}
… …
return;
}
Submitted by: Administrator
NetState netState = NET_INVALID_STATE;
AEENetStats netStats;
netState = INETMGR_NetStatus (pINetMgr, &netStats);
We can use INETMGR_OnEvent() to monitor both the status of the PPP connection and socket connections. Refer to NetMgrEvent enum in AEENet.h for a list of all network and socket events.
// Register to receive Network and Socket events
INETMGR_OnEvent(piNet, (PFNNETMGREVENT)CheckNetStatus,
(void*)pMe, TRUE);
//Callback invoked when Network/Socket event is received
static void CheckNetStatus(void* cxt,
NetMgrEvent evt, uint32 dwData) {
SampleApp *pMe = (SampleApp*)cxt;
if(evt == NE_PPP) {
// network event. dwData = NetState enum value
// refer NetState data structure in BREW API Reference doc
}
if(evt == NE_SO_CLOSING || evt == NE_SO_CLOSED) {
// socket event - closing or closed.
// DwData is pointer to socket
}
… …
return;
}
Submitted by: Administrator
Read Online Brew Job Interview Questions And Answers
Top Brew Questions
☺ | How to handle the case when we lose cellular coverage? |
☺ | What precautions should we take when I invoke INETMGR_GetHostByName() to perform DNS lookup? |
☺ | When reading from a socket the phone reads whatever it can in one go, while the emulator reads large packets in chunks. Why? |
☺ | Does BREW support blocking sockets? |
☺ | Why does ISHELL_CreateInstance return ECLASSNOTSUPPORT when I try and create an instance of the net manager (AEECLSID_Net)? |
Top Mobile OS Categories
☺ | iOS Interview Questions. |
☺ | Asha OS Interview Questions. |
☺ | Windows Phone (WP) Interview Questions. |
☺ | iOS Developer Interview Questions. |
☺ | BlackBerry Tablet OS Interview Questions. |