Network Sniffer - Software network packet sniffer & protocol analyzer for Windows
Download Device Monitoring Studio Hide this button

UDP Session Object

UDP Session object represents a running UDP session. It implements the IUdpSession interface. A reference to a session object is obtained through the INetworkManager.createUdpSession method.

Asynchronous API

UDP Session API is asynchronous. All methods (except IUdpSession.stop) return promise objects. This means that they complete immediately and the caller needs to schedule a continuation to get the result of the operation. This can be done using the call to Promise.then or using ES2017 await keyword.

Starting and Stopping UDP Session

Client UDP session should be started with a call to IUdpSession.connect method. It returns a promise that is completed as soon as connection is established. Server UDP session should be started with a call to IUdpSession.bind method.

To stop a session, call IUdpSession.stop method. When UDP session object is collected by garbage collector, the session is closed automatically.

Sending and Receiving Data

UDP Session object implements the IUdpSession.send method with three overloads that allows the user script to send the data to the UDP session. Method returns promise that completed as soon as data sending is finished.

To receive data from a session, call IUdpSession.receive method. It returns a promise object (Promise<Uint8Array>).