#include <network_ip.h>
Static interface to access network functionality.
Public Member Functions | |
MAXON_OBSERVABLE_STATIC (void, ObservableNetworkInterfaceChanged,(), ObservableCombinerRunAllComponent) | |
Static Public Member Functions | |
static MAXON_METHOD Result< NetworkConnectionRef > | OpenListener (const NetworkIpAddrPort &address, const ThreadRef &thread, TimeValue connectionTimeout, Bool useNagleAlgorithm) |
static MAXON_METHOD Result< NetworkConnectionRef > | OpenListener (const String &address, const ThreadRef &thread, TimeValue connectionTimeout, Bool useNagleAlgorithm) |
static MAXON_METHOD Result< NetworkConnectionRef > | OpenWaitForIncoming (const NetworkConnectionRef &listener, const ThreadRef &connection, TimeValue connectionTimeout, Bool fullDuplex) |
static MAXON_METHOD Result< NetworkConnectionRef > | OpenOutgoing (const NetworkIpAddrPort &address, const ThreadRef &thread, TimeValue connectTimeout, TimeValue sessionTimeout, Bool useNagleAlgorithm, Bool fullDuplex) |
static MAXON_METHOD Result< NetworkConnectionRef > | OpenOutgoing (const String &address, const ThreadRef &thread, TimeValue connectTimeout, TimeValue sessionTimeout, Bool useNagleAlgorithm, Bool fullDuplex) |
static MAXON_METHOD Result< String > | GetHostname () |
static MAXON_METHOD Result< String > | GetHostname (const NetworkIpAddr &ipAddr, Bool useShortHostname=false) |
static MAXON_METHOD ReturnResolveError | ResolveHostname (const String &address, PROTOCOL ptype, BaseArray< NetworkIpAddr > &arr, Bool firstMatch=true, Bool forceResolve=false) |
static MAXON_METHOD Result< void > | SplitAddress (const String &address, String *scheme, String *host, Int32 *port) |
static MAXON_METHOD Result< Bool > | SocketIOWait (SOCKET socket, SOCKETMODE mode, TimeValue timeoutMode, const ThreadRef &bt) |
static MAXON_METHOD Result< NetworkIpAddr > | GetIpAddress (const String &address, Bool resolve=true, Bool forceResolve=false) |
static MAXON_METHOD Result< NetworkIpAddrPort > | GetIpAddressAndPort (const String &address, Bool resolve=true, Bool forceResolve=false) |
static MAXON_METHOD Result< void > | WakeOnLan (const BaseArray< UChar > &macAddress, const NetworkIpAddr &broadcastAddress) |
static MAXON_METHOD String | GetTimeString () |
static MAXON_METHOD NetworkIpAddr | GetBroadcastAddress (const NetworkIpAddr &ipAddress, const NetworkIpAddr &subnetMask) |
static MAXON_METHOD Result< BaseArray< UChar > > | GetMacAddress () |
static MAXON_METHOD String | MacAddressToString (const BaseArray< UChar > &macAddress) |
static MAXON_METHOD Result< Int > | GetAdapterIndex (const String &adapterName) |
static MAXON_METHOD Result< NetworkAdapter > | GetBestNetworkAdapter (PROTOCOL protocol=PROTOCOL::IPV4) |
static MAXON_METHOD Result< BaseArray< NetworkAdapter > > | GetAllNetworkAdapters () |
static MAXON_METHOD Result< Int > | GetAdapterIndex (const NetworkIpAddr &address) |
Private Member Functions | |
MAXON_INTERFACE_NONVIRTUAL (NetworkIpInterface, MAXON_REFERENCE_NORMAL, "net.maxon.interface.networkip") | |
|
private |
|
static |
Creates an NetworkIpConnection listener. When the listener is created use OpenWaitForIncoming() to wait for incoming connections. Shutdown the listener with CloseConnection(). When the machine / device goes into the sleep mode and wakes up again, the listener is still active and ready to accept connections.
[in] | address | Addresses where the socket is binded to. Pass en empty instance to listen on all adapters. |
[in] | thread | Thread object where this function is called from. Used to interrupt a connection on TestBreak() |
[in] | connectionTimeout | Timeout of the listener object. Use SOCKETTIMEOUT_INDEFINITELY to disable timeout. Use NETWORK_DEFAULT_CONNECTION_TIMEOUT if you want to have the recommended default values. |
[in] | useNagleAlgorithm | Set to true to use the Nagle algorithm, otherwise false. |
|
static |
Creates an NetworkIpConnection listener. When the listener is created use OpenWaitForIncoming() to wait for incoming connections. Shutdown the listener with CloseConnection(). When the machine / device goes into the sleep mode and wakes up again, the listener is still active and ready to accept connections.
[in] | address | Address as string where the socket is binded to (e.g. "192.168.10.200:1234"). Pass en empty string or "0" |
[in] | thread | Thread object where this function is called from. Used to interrupt a connection on TestBreak() |
[in] | connectionTimeout | Timeout of the listener object. Use SOCKETTIMEOUT_INDEFINITELY to disable timeout. Use NETWORK_DEFAULT_CONNECTION_TIMEOUT if you want to have the recommended default values. |
[in] | useNagleAlgorithm | Set to true to use the Nagle algorithm, otherwise false. |
|
static |
Waits for an incoming connection and blocks until a connection was established.
[in] | listener | Listener object from OpenListener(). |
[in] | connection | Thread object where this function is called from. Used to interrupt this call on TestBreak(). |
[in] | connectionTimeout | Timeout in seconds for further operations like send or receive. Use SOCKETTIMEOUT_INDEFINITELY to disable timeout. Use NETWORK_DEFAULT_CONNECTION_TIMEOUT if you want to have the recommended default values. |
[in] | fullDuplex | Set the connection to full duplex mode which means that parallel read and write is allowed. |
|
static |
Opens a connection. Supports IPv4 and IPv6.
[in] | address | Pass a host name to connect to. Can be an IPv4, IPv6 address or a host name. |
[in] | thread | Optional thread which should be checked for cancellation (see SetThread). |
[in] | connectTimeout | Timeout in seconds for the initial connection. Use NETWORK_DEFAULT_INITIAL_TIMEOUT if you want to have the recommended default values. |
[in] | sessionTimeout | Timeout in seconds for further operations like send or receive. Use SOCKETTIMEOUT_INDEFINITELY to disable timeout. Use NETWORK_DEFAULT_CONNECTION_TIMEOUT if you want to have the recommended default values. |
[in] | useNagleAlgorithm | Pass true to set the TCP/IP flag for TCP_NODELAY. For more information see: http://msdn.microsoft.com/en-us/library/ms817942.aspx. |
[in] | fullDuplex | Set the connection to full duplex mode which means that parallel read and write is allowed. |
|
static |
|
static |
Returns the host name of the local machine.
|
static |
Returns the host name of given ip address.
MAXON_OBSERVABLE_STATIC | ( | void | , |
ObservableNetworkInterfaceChanged | , | ||
() | , | ||
ObservableCombinerRunAllComponent | |||
) |
|
static |
Resolves a host name. If the address object can be an ip address object, you should use GetIpAddress(address, a, true) instead.
[in] | address | Host name to resolve. |
[in] | ptype | Pass PROTOCOL::IPV4 if the result should just contain IPv4 address, same for PROTOCOL::IPV6 with IPv6 address and PROTOCOL::ALL for all addresses. |
[out] | arr | Contains the addresses of the host name when the function succeeded. |
[in] | firstMatch | Address array has a maximum size of 1 element. |
[in] | forceResolve | Set to true to resolve the address via the DNS system. |
|
static |
Splits a passed address in its elements.
|
static |
|
static |
Converts a host name, IPv4 or IPv6 address into an ip address object. A port value in the address will be ignored. When the resolve option is enabled, the call blocks and waits for the DNS system when the address is a host name. E.g: address: Sebastians-Macbook-Pro.local (DNS system used, call blocks) address: 192.168.10.1 (no DNS system used, call does not block)
[in] | address | IP address or host name. If the string is a host name, resolve must be set to true otherwise the function fails. |
[in] | resolve | Set to true to resolve the address via the DNS system. |
[in] | forceResolve | TODO: (Seb) ? |
|
static |
Converts a host name, IPv4 or IPv6` address into an ip address object. The address can have a port value. When the resolve option is enabled, the call blocks and waits for the DNS system when the address is a host name. E.g: address: Sebastians-Macbook-Pro.local:1234 (DNS system used, call blocks) address: 192.168.10.1:1234 (no DNS system used, call does not block)
[in] | address | IP address or host name. If the string is a host name, resolve must be set to true otherwise the function fails. |
[in] | resolve | Set to true to resolve the address via the DNS system. |
[in] | forceResolve | TODO: (Seb) ? |
|
static |
Wakes a computer up by WOL (Wake-On-LAN). Currently only IPv4 is supported. To get WOL to work, a broadcast message on port '9' will be sent.
[in] | macAddress | Mac-Address of the machine which will be woken up. |
[in] | broadcastAddress | Broadcast address where the message should be send to. |
|
static |
Create a human-readable time string.
|
static |
Convert a IPv4 broadcast address by a given ip and subnet address.
[in] | ipAddress | IP address. |
[in] | subnetMask | Subnet address. |
|
static |
Get the mac address of the machine. When this function returns false an error occurred, but then macAddress is filled at least with a random-generated macAddress. The random-generated mac address will be changed after a restart of the host application.
|
static |
Prints a mac address to the debug console. The output is visible in debug builds or in a release build when the debug console with diagnostic output is activated.
[in] | macAddress | The mac address. |
|
static |
Returns the adapter index. The interface name "all" returns 0.
[in] | adapterName | The name. |
|
static |
Returns the best network adapter to the specified protocol.
[in] | protocol | Specified protocol. |
|
static |
Returns all current active network adapter objects.
|
static |
Returns the interface index of the network adapter that is in the same network as the given address. It's not required that the address is assigned to the adapter itself. If no match was found, -1 is returned.