# getServerIp (Client)

> Returns the address of the server this client is connected to.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Network and HTTP
- **URL**: https://wiki.mymp.gg/en/getServerIp-client

## Syntax

```lua
string getServerIp([bool withPort = false])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `withPort` | `bool` | If `true`, `:port` is appended. *(default: `false`)* |

## Returns

The address, with `:port` if asked. An empty string if the client is not connected.

## Example

```lua
addCommandHandler("server", function()
    print("connected to " .. getServerIp(true))
end)
```

## See also

- [isStreamerMode (Client)](https://wiki.mymp.gg/en/isStreamerMode.md): Tells whether streamer mode is on. In it, the console masks every IPv4 address it shows.
