[in] TCP port number of the TCP connection to be established.
PortType
[in] Filtering type for the port participating in TCP connection, as it is defined in
HNLBPortFilter enumeration.
Description:
Use LbAdpAddFilterTcpPort to define the rule for tracking of re-created TCP sessions for local OS.
Using of filtration rules for TCP connections allows to track only necessary ones, that
dramatically increases the application performance and reliability.
You can change certain port type by function call with changed port filtering type for the same
port.
Example of tracking connections to the LOCAL port 80:
// OnLBConnect event handler
void __stdcall OnLBConnect(DWORD_PTR Param, DWORD_PTR ThParam, HANDLE hLBSession, HANDLE hLBHosts, DWORD Direction)
{
if (Direction == ldL2R)
{
...
}
}
...
// Create HNLBAdapter object
HANDLE hAdp = LbAdpCreate();
// HNLBAdapter settings
LbAdpSetOnConnect(hLbAdp, OnLBConnect, 0);
// Turn off UDP trafic capturing
LbAdpSetCaptureUdp(hLbAdp, FALSE);
// Add rule for TCP connections on the LOCAL port 80
LbAdpAddFilterTcpPort(hLbAdp, 80, lpfLocal);
// Set flag of using such rules
LbAdpSetUseTcpPortFilters(hLbAdp, TRUE);
// Open adapter
DWORD Res = LbAdpOpenAdapter(hLbAdp);
...