先来看下两个接口的定义
STATUS routeNetAdd
(
char * destination, /* inet addr or name of network destination */
char * gateway /* inet addr or name of gateway to destination */
)
STATUS mRouteAdd
(
char * pDest, /* destination addr in internet dot notation */
char * pGate, /* gateway address in internet dot notation */
long mask, /* mask for destination */
int tos, /* type of service */
int flags /* route flags */
)
你可以看到mRouteAdd多了mask tos flags这几个参数,但mRouteAdd的作用主要是给相同的网段指明不同的网关。
看下面的例子
mRouteAdd ("90.0.0.0", "91.0.0.3", 0xffffff00, 0, 0);