一个 client 访问多个server,不建议使用系统的WSNADDR 环境变量。建议使用
tuxreadenv 函数。或者使用tuxputenv.其实最好使用tuxreadenv.因为tuxreadenv 是
读取配置的环境变量
例子如下:
iRet = tuxreadenv("tuxenv.ini","SVR1");
/* 访问SVR1 host */
if (iRet < 0)
{
userlog("error on tuxreadenv SVR1");
tpfree(char *)RcvBuf;
return -1;
}
.......................
iRet = tuxreadenv("tuxenv.ini","SVR2");
/* 访问SVR2 host */
if (iRet < 0)
{
userlog("error on tuxreadenv SVR2");
tpfree(char *)RcvBuf;
return -1;
}
tuxenv.ini 文件内容如下:
[SVR1]
TUXDIR=/home/tuxdeo /* TUXDIR=c:\tuxedo on windows */
PATH=$PATH TUXDIR/bin /* %PATH%;%TUXDIR%/bin on Windwos*/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH TUXDIR/lib
WSNADDR=//192.168.0.1:6000
[SVR2]
TUXDIR=/home/tuxdeo /* TUXDIR=c:\tuxedo on windows */
PATH=$PATH TUXDIR/bin /* %PATH%;%TUXDIR%/bin on Windwos*/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH TUXDIR/lib
WSNADDR=//192.168.0.1:6001