shown in fig6 generally a state 1600 is an offline state state 1610 is entered when a connection request is received in the offline state state 1620 is an online state state 1630 is an online connection request state and state 1640 is entered when the router is disconnecting and receives a connection request the procedures called to implement these states are now discussed pkg_hgs_connection contains the stored procedures to record connection requests from devices to inform routers of devices requiring connection and to record the connection state of these devices pkg_hgs_connection has the following stored procedures that are called from the c router sp_hgs_connect_request u2014 used by the router to transmit the set of devices issuing connect requests sp_hgs_connection_activity u2014 used by the router to transmit the set of devices whose connect states has changed sp_hgs_connect u2014 returns the set of devices requiring connection because of connect requests sp_hgs_msg_connect u2014 returns the set of devices requiring connection because of messages pending sp_hgs_disconnect u2014 returns the set of devices requiring disconnection from stale connections pkg_hgs_connection also contains a stored procedure sp_hgs_one_connect_request that may be called externally by other stored procedures to bring a device online this may be done to prepare the device to receive messages from a service sp_hgs_connect_request u2014 this stored procedure records connection requests from devices devices send their ip address and listener port when they have messages to send to a router the stored procedure records these in the database the.