A method of providing a routing protocol in a sensor network includes the
steps of: initializing a routing table and searching a network device of
a node to initialize a host; opening a socket when there is a request for
forwarding of an IP (Internet Protocol) packet from an upper layer or
when there is a request through the network device; determining whether
there is the IP packet forwarding request of the upper layer node or
whether the packet is received from the network device; if there is the
IP packet forwarding request of the upper layer, searching the routing
table, and determining whether or not there is a destination node which
intends to transmit the packet, and returning to a main loop if there is
the destination node; and if the packet is received through the network
device, determining types of the received packets and performing RREQ
(route request) process, IDLE process, RREP (route reply) process, RERR
(route error) process, and RREP_ACK (route reply acknowledgement)
process.