Log In    |    Knowledge Base    |    4D Home
Tech Tip: New parameter behavior with "TCP_Listen"
PRODUCT: 4D Internet Commands | VERSION: 6.8.1 | PLATFORM: Mac & Win
Published On: July 31, 2002

Compatibility: 6.8.1 Internet Commands or higher only
Platforms: Windows and Mac OS


Under 4D Internet Commands 6.8.1 the command TCP_Listen has a new parameter behavior. In previous versions, if the variable remoteHost was left empty, it accepted an incoming connection from any machine. While this is still true under 6.8.1, in addition to this, the command will return into remoteHost the IP address of the connected machine.

Therefore it is now possible to filter the IP address of the remote host, making the process more efficient.

A quick example:


$err:=TCP_Listen (remoteHost;8000;8000;60;vTCPID)
$err:=TCP_State (vTCPID;vStatus)
If ((vStatus=8) & (remoteHost="")) `connection was established and desired IP connected
$err:=TCP_Close (vTCPID)
End if

For more information, please take a look at the 6.8.1 Internet Commands addendum pg. 58 TCP_Open under TCP Commands.