![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a Universe session (AIX), and need a program to write test data when its IP address is one I specify in the code. SYSTEM(42) is NT only. Is there a way to discover which IP address this program is running on inside the program? Thanks! Ed |
#3
| |||
| |||
|
|
I have a Universe session (AIX), and need a program to write test data when its IP address is one I specify in the code. SYSTEM(42) is NT only. Is there a way to discover which IP address this program is running on inside the program? Thanks! Ed |
#4
| |||
| |||
|
|
I believe you want the IP address of the connecting client, not the server. Commands and data structures vary from one *nix platform to the next so I can only provide generalities (unless I'm commissioned for a solution). On the connecting process, you may be able to parse the result of a SH to "whoami" to get what you want. Try "who -m" to see if it's any different. If the data has the IP address in parentheses, you can parse it in BASIC, or use this as your shell command: who -m | cut -f2 -d\( | cut -f1 -d\) If that doesn't help, I believe that data is stored in utmp (directory varies) and you might find a PHP, Perl, Java, or other utility that reads/parses utmp data. You might need to first get the tty from some command and then use that as a key to get the data you want from utmp. Also note that doing this with SSH might be different than telnet. SSH might load an environment variable with the client IP address. Use "env" to see what's in there for your system. That's all I got on me. A real answer would require real research, sorry. HTH T "Ed Sheehan" wrote: I have a Universe session (AIX), and need a program to write test data when its IP address is one I specify in the code. SYSTEM(42) is NT only. Is there a way to discover which IP address this program is running on inside the program? Thanks! Ed |
#5
| |||
| |||
|
|
I believe you want the IP address of the connecting client, not the server. Commands and data structures vary from one *nix platform to the next so I can only provide generalities (unless I'm commissioned for a solution). On the connecting process, you may be able to parse the result of a SH to "whoami" to get what you want. Try "who -m" to see if it's any different. If the data has the IP address in parentheses, you can parse it in BASIC, or use this as your shell command: who -m | cut -f2 -d\( | cut -f1 -d\) If that doesn't help, I believe that data is stored in utmp (directory varies) and you might find a PHP, Perl, Java, or other utility that reads/parses utmp data. You might need to first get the tty from some command and then use that as a key to get the data you want from utmp. Also note that doing this with SSH might be different than telnet. SSH might load an environment variable with the client IP address. Use "env" to see what's in there for your system. That's all I got on me. A real answer would require real research, sorry. HTH T "Ed Sheehan" wrote: I have a Universe session (AIX), and need a program to write test data when its IP address is one I specify in the code. SYSTEM(42) is NT only. Is there a way to discover which IP address this program is running on inside the program? Thanks! Ed |
#6
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |