TCP Server Send File
ActionStep Reference » Windows » Network » TCP » TCP Server Send File
The TCP Server Send File ActionStep enables the transmission of a file from a TCP server to a specified TCP client over the network.
- Open the Windows node in the Workspace Explorer.
- Open the Network node.
- In the TCP node, select the TCP Server Send File ActionStep.
Parameters:
The ActionStep has the following input parameters:
name |
Description
|
---|---|
Name
|
The name of the TCP server.
Allowed Context Scopes [Fixed, Local, Global]
|
Address
|
The IP address of the client in the network.
Default IP address: 127.0.0.1 Allowed Context Scopes [Fixed, Local, Global]Allowed Context Types [Variable, Parameter, Enum] |
Port
|
The designated port number of the client. Default port number: 80
Allowed Context Scopes [Fixed, Local, Global]
|
Path Name |
The path name of the file to be sent to the client.
Allowed Context Scopes [Fixed, Local, Global] Allowed Context Types [Variable, Parameter, Enum] |
Example 1 (Transmit a text file to TCP client):
This example creates two local variables, ServerName and ServerPassword, with Text as data type and values are used to start a TCP server. The server receives a message sent by the TCP client after waiting for 10 seconds. The requested text file by the client is then sent by the server after setting the client's IP address and port number. A notice that the server has sent the file is displayed via Message Box.
Example 2 (Send a message and a file to TCP client):
This example creates two local variables, ServerName and ServerPassword, with Text as data type and values are used to start a TCP server. The server then waits for incoming messages from TCP clients. If the Message Count is greater than zero, the server iterates through the list of messages received and sends a reply and a document file to the TCP clients. A notice is displayed via Message Box after successfully sending the message and file.
See other TCP operations: