Use the TCP commands in Python™
to connect to another device using the TCP/IP protocol. This command uses
an indexer to allow multiple connections, see Python
command: SQL. It has no default connection
All connections are temporary. See Python
commands for other commands you can use with GainSeeker.
Syntax |
Example |
Description/Remarks |
New or changed in GainSeeker version |
tcp[x].connect(hostname, port) |
tcp[0].connect("192.168.4.4", 70) |
Connect to the target host (URL or IP address) on the specified port. Returns True or False. Note: You must use the IPv4 address of the TCP server for hostname (not the PC name, "localhost", or "127.0.0.1"). |
|
tcp[x].disconnect() |
tcp[0].disconnect() |
Disconnect from the host. |
|
tcp[x].receive(timeout) |
tcp[0].receive(500) |
Listens for a message from the host given some timeout period. 0 is indefinite. Returns a string. The timeout is measured in milliseconds. |
|
tcp[x].transmit(message) |
tcp[0].transmit("my message") |
Transmit a message to the connected host. Returns True if successfully transmitted. |
|
tcp[x].transmitreceive(message, timeout) |
tcp[0].transmitreceive("my message", 500) |
Transmits a message, then awaits a reply given some timeout. Returns a string. The timeout is measured in milliseconds. |
|