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

INetworkManager Interface

interface INetworkManager {

    // Methods
    ${createTcpSession}(ipAddress: string, port: number): ${ITcpSession};
    ${createUdpSession}(): ${IUdpSession};
    ${createTcpListener}(host: string, port: number): Promise<${ITcpListener}>;
    ${getSessions}(type: ${Network.SessionType}): ${INetworkSession}[];
}
// This interface is not available in managed environment
// This interface is not available in native environment

INetworkManager Methods

createTcpSession

createTcpSession(ipAddress: string, port: number): ${ITcpSession};
// This method is not available in managed environment
// This method is not available in native environment
ipAddress
A destination address. This may be either IPv4 address, IPv6 address or DNS name.
port
Destination port number.

Returns the reference to created session object.

Creates new TCP session.

Create new TCP session:

var session = networkManager.createTcpSession("192.168.33.50", 502);

createUdpSession

createUdpSession(): ${IUdpSession};
// This method is not available in managed environment
// This method is not available in native environment

Returns the reference to created session object.

Creates new UDP session.

Create new UDP session:

var session = networkManager.createUdpSession();

createTcpListener

createTcpListener(host: string, port: number): Promise<${ITcpListener}>;
// This method is not available in managed environment
// This method is not available in native environment
host
A local host name. Used to open a listening socket.
port
Local port number.

Returns a promise that yields a reference to the prepared listener object.

Creates new TCP listener object.

Listen for a new TCP connection

async function listen() {
    var l = await networkManager.createTcpListener("localhost", 80);
    var socket = await l.listen();
}

getSessions

getSessions(type: ${Network.SessionType}): ${INetworkSession}[];
// This method is not available in managed environment
// This method is not available in native environment
type
Type of sessions to return.

Array of requested session objects.

Retrieve the array of TCP or UDP (or both) session objects.

Obtain a list of TCP sessions.

var tcpSessions = networkManager.getSessions(Network.SessionType.Tcp);