montanac
15th April 2002, 18:15
I am trying to recognise the operating system of the BW client.

I am using the function get.display.data( ref long server_data(SRVMAXSIZE) )

Microsoft operating system srv.display.os.type(server_data) DSBW_WIN_311
DSBW_WIN_NT
DSBW_WIN_95
NT4


But it seems that the function always gives back DSBW_WIN_95.

Did you get to the same problem?

By the way, is there a solution to get the IP address and computer name of the client without having to use cumbersome batch script on the client side?


Ciao.
Claudio.

mark_h
15th April 2002, 20:34
On our 98, W2K and XP machines this appears to always return DSBW_WIN_95. Not really sure what this command is doing. Is this returning info from the server display piece or the client. Looks like the server.

And I do not know of a easy method of getting the IP address of the client. A little more info on what you are attempting to do may help someone come up with a solution.

Good Luck!

Mark

dbinderbr
21st May 2002, 08:07
Hello friends,

You should use the following function:

Syntax

long ostype()

Description

This returns a long value that indicates the operating system environment. The possible values are:

OS_WINDOWS_NT Windows/NT
OS_WINDOWS_95 Windows 95
OS_UNIX All UNIX variants

Context

Bshell function.

~Vamsi
21st May 2002, 08:20
Hi,

The ostype() is supposed to return the O/S on the server and not the client.

NPRao
21st May 2002, 09:15
I am at home that I cannot send the syntactically correct compiled code.

here is the basic logic to get the windows versions or any client versions (maybe a BaaN 4 – Unix ASCII interface), you are working on -


#pragma used dll ottdllbw

long fp
long ret
string fname(80)
string comd(256)
string buffer(1024)

fname = “tmp” & str$(utc.num())
|* generate a random file name for windows file redirection.
|* you can use the commands – ver/cmd from DOS/WINDOWS to get the version information.


C:\>ver

Microsoft Windows 2000 [Version 5.00.2195]

C:\>cmd
Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

C:\>


|* If you are using the ver command and redirect the output to a file, then you get 3 lines, 1st and 3rd lines are blanks, and 2nd line contains the windows version. So you need to parse the file to get the version information
|* Alternatively, you can use the command cmd, which gives the 3 lines of output, but we parse only the 1st line to read the version.

comd = "cmd > " & fname
ret = app_start(comd, “”, “”,””,””)

if ret > =0 then
|* >=0 success; identification number of the started application is returned
fp = seq.open.local(fname, “r”, 1)
if fp < 1 then
message(“File handling error”)
exit(1)
endif
ret = seq.read.local(buffer, 1024, fp)
|* buffer now contains the string –
|* Microsoft Windows 2000 [Version 5.00.2195]
seq.close.local(fp)
else
|* this must be unix os as the cmd isn’t recognized.
|* you can use the ostype() to verify if its a Unix operating system.
|* long ostype()
|* Description
|* This returns a long value that indicates the operating system environment. The possible |* values are:
|* OS_WINDOWS_NT Windows/NT
|* OS_WINDOWS_95 Windows 95
|* OS_UNIX All UNIX variants
|* To extend the functionality to detect which particular Unix version one is using, you
|* have to use the unix command – uname, maybe the option -a
comd = “uname > ” & fname
fp = seq.open (fname, “r”)
if fp < 1 then
message(“File handling error”)
exit(1)
endif
ret = seq.read(buffer, 1024, fp)
|* buffer now contains the string –
|* HP-UX-11.0 – I cannot get the exact unix output now at home.
seq.close (fp)
ret = seq.unlink(fname)
endif


Hope you can pick up the clues and try to make it work, I will try to put a better compileable code tommorow.

NPRao
13th March 2003, 03:11
Claudio,

Better late than never I found the answer :D

By the way, is there a solution to get the IP address and computer name of the
client without having to use cumbersome batch script on the client side?


You can use the tools function -
get.bw.hostname() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_system_and_user_information_get_bw_hostname)
to get the Computer Name from which you connect to the BaaN Server.

If you are on the Unix - to get the last connected IP-Address you need to use the
Unix Commands or a 1-line shell script

last -R -1 <user-name> | tr -s ' ' | cut -f3 -d" "


If you are on Windows then, you can do app_start() with the command - ipconfig and redirect the output to a file. Then parse the file for IP-Address, DNS name, Operating system etc.

You can also find this info from the $BSE/log/log.<bshell-name>

2003-02-07[16:23:04(UTC+05:00)]:E:nprao: Pid 15542 Uid 12372 Euid 12372 Gid 1
25 Egid 125 Pset nprao@MBN123456:1144