如何在服务中获得客户端的IP?
我写了个服务如下,调用TMIB,但是获得为空
#include <fml32.h>
#include <tpadm.h>
#include <stdio.h>
#include <ctype.h>
#include <atmi.h> /* TUXEDO Header File */
#include <userlog.h> /* TUXEDO Header File */
/* tpsvrinit is executed when a server is booted, before it begins
processing requests. It is not necessary to have this function.
Also available is tpsvrdone (not used in this example), which is
called at server shutdown time.
*/
#if defined(__STDC__) || defined(__cplusplus)
tpsvrinit(int argc, char *argv[])
#else
tpsvrinit(argc, argv)
int argc;
char **argv;
#endif
{
/* Some compilers warn if argc and argv aren't used. */
argc = argc;
argv = argv;
/* userlog writes to the central TUXEDO message log */
userlog("Welcome to the simple server");
return(0);
}
/* This function performs the actual service requested by the client.
Its argument is a structure containing among other things a pointer
to the data buffer, and the length of the data buffer.
*/
#ifdef __cplusplus
extern "C"
#endif
void
#if defined(__STDC__) || defined(__cplusplus)
MYMIB(TPSVCINFO *rqst)
#else
MYMIB(rqst)
TPSVCINFO *rqst;
#endif
{
long blen;
FBFR32 *ibuf;
char mystr[1000]="";
ibuf = (FBFR32 *)tpalloc("FML32", NULL, 10000);
userlog("0");
Fchg32(ibuf, TA_OPERATION, 0, "GET", 0);
Fchg32(ibuf, TA_CLASS, 0, "T_CLIENT", 0);
userlog("1");
Fprint32(ibuf);
userlog("2");
if (tpcall(".TMIB", (char *)ibuf, 0, (char **)&ibuf, &blen, 0) == -1)
{
printf("tpcall(.TMIB) failed: %s\n", tpstrerror(tperrno));
Fprint32(ibuf);
userlog("call error");
tpreturn(TPSUCCESS, 0, rqst->data, 0L, 0);
}
userlog("3");
/* if (tpadmcall(ibuf, &ibuf, 0) == -1)
{
printf("tpcadmcall() failed: %s\n", tpstrerror(tperrno));
Fprint32(ibuf);
return(-1);
}*/
Fget32(ibuf,TA_NADDR,0,mystr,0);
userlog("%s",ibuf);
tpfree((char *)ibuf);
tpterm();
tpreturn(TPSUCCESS, 0, rqst->data, 0L, 0);
}
谁能解决一下这个问题?