Connects to an FTP server (File 传递 Protocol) or to an RPC server (Remote Procedure Call) created by WinDev.
Note: the connection of a new client cannot be automatically detected. A specific programming is required.
// Connects to a RPC server on port 5010
<Result> = 网络连接(<Computer Address> , <Server> , <User Name> , <Password> [, <Encryption> [, <Type of Network> [, <Port Number> [, <Key>]]]])
- Identifier of the connection,
- 0 if the connection failed. 错误信息 returns more details about the error.
<Computer Address>: Character string (with quotes)
- IP address of the server in xxx.xxx.xxx.xxx format (returned by 网络IP地址),
- Name of the server (returned by 网络本地主机名).
Type of server:
|服务器.FTP||Using a WinDev FTP server. All the NET functions can be used.|
|服务器.RPC||Using a WinDev RPC server. The functions for file transfer are not available.|
<User Name>: Ansi character string (with quotes)
Name of the user who is trying to connect. Combined with <Password>, this parameter allows you to identify the user (see the Notes).
<Password>: Ansi character string (with quotes)
Password associated with the user who is trying to connect (see the Notes).
<Encryption>: Optional boolean
If the server is started with the encryption option set to 真 (网络启动服务器), the client computers must connect with 网络连接 by using <Encryption> = True.
- 真 to encrypt the transmitted data,
- 假 (default value) for no encryption.
If the encryption is requested, the connection key (<Key> parameter) will also be encrypted.
<Type of Network>: Optional integer constant
Time-out used for the connection. This parameter can correspond to:
- the duration of the response time-out in milliseconds,
- a specific constant.
|Value suited for Internet (long response time)|
|内联网||Value suited for Intranet (short response time)|
<Port Number>: Optional integer
Number of the port on which the server must be run. By default, the client attempts to connect to the server on port 2000 for RPC and on port 2001 for FTP.
<Key>: Optional Ansi character string
Used to secure the access to the server. Each client trying to connect to the server must use the same key as the one defined by 网络启动服务器. The connection is refused if the keys are different.
If the <Encryption> parameter is set to 真, the key is encrypted.
Parameters of the server
Some server parameters are required before a connection can be established:
- IP address of the server
- Type of server: RPC or FTP
- Encryption of the server
- Port of the server
- Key if this one is specified when the server is strated
User name and password
<User Name> and <Password> allow the server to find out whether the user is an authorized user or not.
The list of authorizations and passwords for the users is available in the WDRPCSRV.INI file found in the directory of the server project.
Example of file content:
USERNAME1 = PASS1
USERNAME2 = PASS2
USERNAME3 = PASS3
WinDev allows you to use standard FTP with FTP建立连接