Remarks
The bind function is used on an unconnected socket before subsequent calls to the connect or listen functions. It is not neccessary to use bind for connect(), but is required for listen(). This binding process is performed by the connect() function implicitly.
.
//Attempt to connect.
.
public static extern int connect(IntPtr s, ref sockaddr_in addr, int addrsize);
.
public static extern int connect(IntPtr s, ref sockaddr_in6 addr, int addrsize);
.
Declare Function connect Lib "ws2_32.dll" (TODO) As TODO
.
Documentation
[connect] on MSDN
.
AcceptConnection = 2,
.
MaxConnections = 0x7fffffff,
.
UpdateConnectContext = 0x7010,
.
/// WFP's Connection Redirect Records
.
/// WFP's Connection Redirect Context
.
/// WFP's Connection Redirect Records
.
/// WFP's Connection Redirect Context
.
/// keep connections alive
.
// connection is not ack-ed to the
.
/// pause accepting new connections
.
SO_CONNECT_TIME = 0x700C,
.
/// (BSD) style (default) is used. This option can be set on the connection only once. Once this option is set on, this option cannot
.
Summary
Open a dataset of network connections.
.
Summary
Close the dataset holding network connection info
.
Summary
Iterate through available network connections
.
// keep connections alive
.
// enable true conditional accept: connection is not ack-ed to the other side until conditional function returns CF_ACCEPT
quickusb
.
LastError = "USB connection not open, please open";
.
Summary
Closes the connection to the device
.
This function will return a null delimited "\0" list of attached devices. For example, after executing this function with one module connected, nameList will contain "QUSB-0\0\0". If there are two devices plugged in, nameList will contain "QUSB-0\0QUSB-1\0\0".
.
LastError = "USB Connection is not open";
.
LastError = "USB connection not open, please open";
iphlpapi
.
IF_TYPE_FRAMERELAY_INTERCONNECT = 58, // Obsolete, use 32 or 44
.
IF_TYPE_ESCON = 73, // IBM Enterprise Systems Connection
.
IF_TYPE_PROP_CNLS = 89, // Proprietary Connectionless Proto
.
IF_TYPE_FRAMERELAY_MPI = 92, // Multiproto Interconnect over FR
.
public enum NET_IF_CONNECTION_TYPE : uint
.
NET_IF_CONNECTION_DEDICATED = 1,
.
NET_IF_CONNECTION_PASSIVE = 2,
.
NET_IF_CONNECTION_DEMAND = 3,
.
NET_IF_CONNECTION_MAXIMUM = 4
.
public NET_IF_CONNECTION_TYPE ConnectionType;
.
public static List<MIB_TCPROW_OWNER_PID> GetAllTCPConnections()
.
return GetTCPConnections<MIB_TCPROW_OWNER_PID, MIB_TCPTABLE_OWNER_PID>(AF_INET);
.
public static List<MIB_TCP6ROW_OWNER_PID> GetAllTCPv6Connections()
.
return GetTCPConnections<MIB_TCP6ROW_OWNER_PID, MIB_TCP6TABLE_OWNER_PID>(AF_INET6);
.
private static List<IPR> GetTCPConnections<IPR, IPT>(int ipVersion)//IPR = Row Type, IPT = Table Type
.
public MIB_TCPROW_OWNER_PID[] GetAllTcpConnections()
.
TCP_TABLE_BASIC_CONNECTIONS,
.
TCP_TABLE_OWNER_PID_CONNECTIONS,
.
TCP_TABLE_OWNER_MODULE_CONNECTIONS,
.
public List<MIB_TCPROW_OWNER_PID> GetAllTCPv4Connections() {
.
return GetTCPConnections<MIB_TCPROW_OWNER_PID, MIB_TCPTABLE_OWNER_PID>(AF_INET);
.
public List<MIB_TCP6ROW_OWNER_PID> GetAllTCPv6Connections() {
.
return GetTCPConnections<MIB_TCP6ROW_OWNER_PID, MIB_TCP6TABLE_OWNER_PID>(AF_INET6);
.
public List<IPR> GetTCPConnections<IPR, IPT>(int ipVersion) { //IPR = Row Type, IPT = Table Type
.
$y=$x.GetAllTCPv4Connections()
.
/// MIB_IFROW structure array. Content the active networks connection
setupapi
.
MsgBox “Device not connected”
Structures
.
MIXERLINE_LINEF_DISCONNECTED = &H8000
.
public bool fConnected;
.
internal bool fReturnConnected;
.
Summary
The MIB_TCP6ROW_OWNER_PID structure contains information that describes an IPv6 TCP connection associated with a specific process ID (PID).
.
Summary
The MIB_TCPROW_OWNER_PID structure contains information that describes an IPv4 TCP connection with IPv4 addresses, ports used by the TCP connection, and the specific process ID (PID) associated with connection.
.
DISCONNECTED = 0x00008000u,
.
Without the Structlayout the WNetAddConnection2 does not work !!!
The WNetAddConnection2 function makes a connection to a network resource. The function can redirect a local device to the network resource.
9/5/2012 10:52:40 PM - -78.237.25.102
.
Summary
The RASDIALPARAMS structure contains parameters that are used by
RasDial to establish a remote access connection.
The RasDialDlg function establishes a RAS connection using a specified phone-book entry and the credentials of the logged-on user. The function displays a stream of dialog boxes that indicate the state of the connection operation.
5/10/2010 8:00:51 AM - -93.180.241.4
.
Summary
stores the statistics for a single-link RAS connection, or for one of the links in a multilink RAS connection.
.
public int dwConnectionDuration;
.
Public dwConnectionDuration As Integer
.
See docs for RasGetConnectionStatistics
Retrieves accumulated connection statistics for a connection
3/11/2009 2:08:52 PM - -202.114.97.142
.
// Connection/Session counts
.
public int Reconnects;
.
public int CoreConnects;
.
public int Lanman20Connects;
.
public int Lanman21Connects;
.
public int LanmanNtConnects;
.
public int ServerDisconnects;
.
public bool AoAcConnectivitySupported; // Ignore if earlier than Windows 10 (10.0.10240.0)
.
TCP_TABLE_BASIC_CONNECTIONS,
.
TCP_TABLE_OWNER_PID_CONNECTIONS,
.
TCP_TABLE_OWNER_MODULE_CONNECTIONS,
.
TCP_TABLE_BASIC_CONNECTIONS
.
TCP_TABLE_OWNER_PID_CONNECTIONS
.
TCP_TABLE_OWNER_MODULE_CONNECTIONS
.
TCP_TABLE_CLASS = (TCP_TABLE_BASIC_LISTENER,TCP_TABLE_BASIC_CONNECTIONS,
.
TCP_TABLE_OWNER_PID_CONNECTIONS,TCP_TABLE_OWNER_PID_ALL,
.
TCP_TABLE_OWNER_MODULE_LISTENER,TCP_TABLE_OWNER_MODULE_CONNECTIONS,
.
TCP_TABLE_BASIC_CONNECTIONS
.
A MIB_TCPTABLE table that contains all connected TCP endpoints on the machine is returned to the caller.
.
TCP_TABLE_OWNER_PID_CONNECTIONS
.
A MIB_TCPTABLE_OWNER_PID or MIB_TCP6TABLE_OWNER_PID that all connected TCP endpoints on the machine is returned to the caller.
.
TCP_TABLE_OWNER_MODULE_CONNECTIONS
.
A MIB_TCPTABLE_OWNER_MODULE or MIB_TCP6TABLE_OWNER_MODULE that contains all connected TCP endpoints on the machine is returned to the caller.
.
Summary
Used with DeviceIoControl and [USB_DESCRIPTOR_REQUEST] to get either a [USB_STRING_DESCRIPTOR] or [USB_DEVICE_DESCRIPTOR] from a device on a USB Hub
5/15/2017 4:52:31 AM - -94.229.131.27
Retrieve Manufacturer, Product, and SerialNumber strings from a USB device
5/12/2007 10:16:39 PM - egray1@hot.rr.com-24.26.210.211
Used by DeviceIoControl and [IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION] to get the Device Descriptor of a device on a port on a USB Hub
5/13/2009 1:05:47 PM - egray1@hot.rr.com-24.26.210.211
.
public int ConnectionIndex;
.
ULONG ConnectionIndex;
.
Request.ConnectionIndex = PortPortNumber;
.
if (DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, ptrRequest, nBytes, out nBytesReturned, IntPtr.Zero))
.
Summary
Used with DeviceIoControl and [USB_DESCRIPTOR_REQUEST] to get either a [USB_STRING_DESCRIPTOR] or [USB_DEVICE_DESCRIPTOR] from a device on a USB Hub
5/15/2017 4:52:31 AM - -94.229.131.27
.
Is often used as a type inside a USB_NODE_CONNECTION_INFORMATION_EX structure, hence the need for the "Pack=1"
.
Summary
Used with DeviceIoControl and [USB_NODE_CONNECTION_DRIVERKEY_NAME] to get the "Driver Key Name" from a device on a USB Hub
5/15/2017 4:52:43 AM - -94.229.131.27
.
struct USB_NODE_CONNECTION_DRIVERKEY_NAME
.
public int ConnectionIndex;
.
Structure USB_NODE_CONNECTION_DRIVERKEY_NAME
.
Identical to the USB_NODE_CONNECTION_NAME structure
.
typedef struct _USB_NODE_CONNECTION_DRIVERKEY_NAME {
.
ULONG ConnectionIndex;
.
} USB_NODE_CONNECTION_DRIVERKEY_NAME, *PUSB_NODE_CONNECTION_DRIVERKEY_NAME;
.
Documentation
[USB_NODE_CONNECTION_DRIVERKEY_NAME] on MSDN
.
USB_NODE_CONNECTION_DRIVERKEY_NAME DriverKey = new USB_NODE_CONNECTION_DRIVERKEY_NAME();
.
DriverKey.ConnectionIndex = PortPortNumber;
.
if (DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME, ptrDriverKey, nBytes, ptrDriverKey, nBytes, out nBytesReturned, IntPtr.Zero))
.
DriverKey = (USB_NODE_CONNECTION_DRIVERKEY_NAME)Marshal.PtrToStructure(ptrDriverKey, typeof(USB_NODE_CONNECTION_DRIVERKEY_NAME));
.
Summary
Used with DeviceIoControl and [USB_NODE_CONNECTION_INFORMATION_EX] to get information from a port on a USB Hub
5/15/2017 4:53:18 AM - -94.229.131.27
.
struct USB_NODE_CONNECTION_INFORMATION_EX
.
public int ConnectionIndex;
.
public int ConnectionStatus;
.
Structure USB_NODE_CONNECTION_INFORMATION_EX
.
typedef struct _USB_NODE_CONNECTION_INFORMATION_EX {
.
ULONG ConnectionIndex;
.
USB_CONNECTION_STATUS ConnectionStatus;
.
} USB_NODE_CONNECTION_INFORMATION_EX, *PUSB_NODE_CONNECTION_INFORMATION_EX;
.
Documentation
[USB_NODE_CONNECTION_INFORMATION_EX] on MSDN
.
int nBytes = Marshal.SizeOf(typeof(USB_NODE_CONNECTION_INFORMATION_EX));
.
IntPtr ptrNodeConnection = Marshal.AllocHGlobal(nBytes);
.
USB_NODE_CONNECTION_INFORMATION_EX NodeConnection = new USB_NODE_CONNECTION_INFORMATION_EX();
.
NodeConnection.ConnectionIndex = i;
.
Marshal.StructureToPtr(NodeConnection, ptrNodeConnection, true);
.
if (DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX, ptrNodeConnection, nBytes, ptrNodeConnection, nBytes, out nBytesReturned, IntPtr.Zero))
.
NodeConnection = (USB_NODE_CONNECTION_INFORMATION_EX)Marshal.PtrToStructure(ptrNodeConnection, typeof(USB_NODE_CONNECTION_INFORMATION_EX));
.
Marshal.FreeHGlobal(ptrNodeConnection);
.
USB_NODE_CONNECTION_INFORMATION_EX connection = new USB_NODE_CONNECTION_INFORMATION_EX();
.
connection.ConnectionIndex = i;
.
size = Marshal.SizeOf(typeof(USB_NODE_CONNECTION_INFORMATION_EX)) + 32 * Marshal.SizeOf(typeof(USB_PIPE_INFO)); // Assuming 32 should be enough, you can make this larger
.
IntPtr ptr_connection = Marshal.AllocHGlobal(size);
.
Marshal.StructureToPtr(connection, ptr_connection, true);
.
if (DeviceIoControl(hHub, IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX, ptr_connection, size, ptr_connection, size, out bytes_returned, IntPtr.Zero))
.
connection = (USB_NODE_CONNECTION_INFORMATION_EX)Marshal.PtrToStructure(ptr_connection, typeof(USB_NODE_CONNECTION_INFORMATION_EX));
.
if (bytes_returned != Marshal.SizeOf(typeof(USB_NODE_CONNECTION_INFORMATION_EX)))
.
int num = (bytes_returned - Marshal.SizeOf(typeof(USB_NODE_CONNECTION_INFORMATION_EX))) / Marshal.SizeOf(typeof(USB_PIPE_INFO));
.
IntPtr ptr_pipeinfo = new IntPtr((byte*)ptr_connection.ToPointer()
.
+ Marshal.SizeOf(typeof(USB_NODE_CONNECTION_INFORMATION_EX))
.
Marshal.FreeHGlobal(ptr_connection);
.
Summary
Used with DeviceIoControl and [USB_NODE_CONNECTION_NAME] to get the Device Path of a device on a USB Hub
5/15/2017 4:53:31 AM - -94.229.131.27
.
struct USB_NODE_CONNECTION_NAME
.
public int ConnectionIndex;
.
Structure USB_NODE_CONNECTION_NAME
.
typedef struct _USB_NODE_CONNECTION_NAME {
.
ULONG ConnectionIndex;
.
} USB_NODE_CONNECTION_NAME, *PUSB_NODE_CONNECTION_NAME;
.
Documentation
[USB_NODE_CONNECTION_NAME] on MSDN
.
USB_NODE_CONNECTION_NAME NodeName = new USB_NODE_CONNECTION_NAME();
.
NodeName.ConnectionIndex = PortPortNumber;
.
if (DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_NAME, ptrNodeName, nBytes, ptrNodeName, nBytes, out nBytesReturned, IntPtr.Zero))
.
NodeName = (USB_NODE_CONNECTION_NAME)Marshal.PtrToStructure(ptrNodeName, typeof(USB_NODE_CONNECTION_NAME));
.
Summary
Used with DeviceIoControl and [USB_NODE_INFORMATION] to get information about ports on a USB Hub
5/15/2017 4:53:40 AM - -94.229.131.27
.
You don't use an IOCTL call directly with a USB_STRING_DESCRIPTOR structure. Instead you use a USB_DESCRIPTOR_REQUEST "request packet" with IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION. The USB_STRING_DESCRIPTOR structure is returned at the very end of the request packet. The whole idea of "writing off the edge" of a structure is counter to the way C#/VB.Net was designed to work, so you'll have to make sure to allocate sufficient amount of memory to handle both the "request packet" and the USB_STRING_DESCRIPTOR structure.
.
Request.ConnectionIndex = PortPortNumber;
.
if (DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, ptrRequest, nBytes, out nBytesReturned, IntPtr.Zero))
.
Byte[] ConnectState;
.
System.Runtime.InteropServices.ComTypes.FILETIME ConnectTime;
.
System.Runtime.InteropServices.ComTypes.FILETIME DisconnectTime;
.
Summary
Contains association attributes for a connection.
.
Summary
Defines the attributes of a wireless connection.
.
public struct WLAN_CONNECTION_ATTRIBUTES
.
/// WLAN_CONNECTION_MODE->_WLAN_CONNECTION_MODE
.
public WLAN_CONNECTION_MODE wlanConnectionMode;
.
Public Structure WLAN_CONNECTION_ATTRIBUTES
.
''' WLAN_CONNECTION_MODE->_WLAN_CONNECTION_MODE
.
Public wlanConnectionMode As WLAN_CONNECTION_MODE
.
WLAN_CONNECTION_MODE
Defines the mode of connection.
11/5/2008 7:03:32 PM - anonymous
.
Documentation
[WLAN_CONNECTION_ATTRIBUTES] on MSDN
.
public struct WLAN_CONNECTION_PARAMETERS
.
public WLAN_CONNECTION_MODE wlanConnectionMode;
.
Structure WLAN_CONNECTION_PARAMETERS
.
WLAN_CONNECTION_MODE
Defines the mode of connection.
11/5/2008 7:03:32 PM - anonymous
.
The rationale behind the change in the history for this is because is that he/she wanted to "unmarshal". However, in functions like WlanConnect(), it is used as an "input". So, it needs to be marshaled. Then I believe they should be IntPtr .
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
.
Documentation
[WLAN_CONNECTION_PARAMETERS] on MSDN
Cut off search results after 60. Please refine your search.