# %gethostid() function

The %gethostid() function allows a FlashBASIC
application to retrieve the unique 32-bit identifier for the current
host. The ID is returned as a decimal number.

**For Windows:**Not Supported

## Syntax

```
var = %gethostid()
```

## Description

If the function fails, a value
of -1 is returned and the FlashBASIC system(0) function
returns the value of errno.

To compile successfully,
the program must include the statement:

```
cfunction socket.builtin
```

## Example(s)

```
cfunction socket.builtin
ID=%gethostid()
if ID=-1 then
 crt ’Cannot get host ID. errno=’:system(0)
 stop
end
```

## See also

- [%accept() function](https://d3codex.com/pickbasic-flashbasic/percent-accept-function/)
- [%bind() function](https://d3codex.com/pickbasic-flashbasic/percent-bind-function/)
- [%listen() function](https://d3codex.com/pickbasic-flashbasic/percent-listen-function/)
- [%socket() function](https://d3codex.com/pickbasic-flashbasic/percent-socket-function/)
- [cfunction statement](https://d3codex.com/pickbasic-flashbasic/cfunction-statement/)
- [system() function](https://d3codex.com/pickbasic-flashbasic/system-function/)

---
Source: https://d3codex.com/pickbasic-flashbasic/percent-gethostid-function/ - part of the D3Codex reference.
