DEFLNG A-Z REM $INCLUDE: 'WinSock2.Dec' DECLARE FUNCTION GetStr$ (s$) DIM W AS WsaData DIM Rc, Rd, V, Re, n$ COLOR 11: CLS PRINT "hostname - simple program to return name of this system" PRINT V = &H202 ' (byte)minor + (byte)major Rc = WsaStartup(V, W) IF Rc <> 0 THEN PRINT "WsaStartup Rc: ", Rc GOTO CloseIt END IF n$ = SPACE$(256) V = 255 Re = gethostname(n$, V) IF Re <> 0 THEN Rd = WsaGetLastError PRINT "gethostname WsaGetLastError Rc: ", Rd END IF PRINT "hostname: '" + GetStr(n$) + "'" PRINT CloseIt: Rc = WsaCleanup IF Rc <> 0 THEN Rd = WsaGetLastError PRINT "WsaCleanup WsaGetLastError Rc: ", Rd END IF END FUNCTION GetStr$ (s$) GetStr$ = LEFT$(s$, INSTR(s$, CHR$(0)) - 1) END FUNCTION