---
title: roNetworkHotplug
slug: develop/ronetworkhotplug
docTags: 
createdAt: 2025-03-11T07:07:18.732Z
---

This object can be used to generate events when a [network interface](docId\:U6ZceYQddlz9xdAKtTmJs) becomes available or unavailable. It will post events of type [roNetworkAttached](docId\:wrxOOghI0XfxsynqOktNf) and [roNetworkDetached](docId\:b2OC8VrdNORy84OaiNKmr) to the associated message port. The JavaScript equivalent is [networkhotplug](docId\:NEizLJQNwCice75OcWKoL).

To determine which network was attached or detached, the script needs to call `GetInt()` or `GetString()` on the *roNetworkAttached*/*roNetworkDetached* event object. These methods provide an index of the network interface that was attached or detached.

:::hint{type="info"}
Reconfiguring a network interface using *roNetworkConfiguration* may cause it to detach and attach again. A DHCP address renewal may cause an *roNetworkAttached* event, even if the IP address hasn't changed.
:::

## ifMessagePort

### SetPort(a As Object)

Posts messages of type *roNetworkAttached*/*roNetworkDetached* to the attached message port.

## ifUserData

### SetUserData(user\_data As Object)

Sets the user data that will be returned when events are raised.

### GetUserData() As Object

Returns the user data that has previously been set via `SetUserData()`. It will return Invalid if no data has been set.
