|
|
|
|
|
- Optimizing the connections for an IP address
- Timeout
- Connecting to an infrared port
- Name resolution
- Required permissions
- Required application feature
SocketConnect (Function) In french: SocketConnecte Connects a client computer to a given socket. Remarks: - UDP sockets: The UDP protocol being a "connectionless" protocol, SocketConnect cannot be used with the UDP protocol. To send or receive data with the UDP protocol, you must create a UDP socket (SocketCreateUDP) then send/receive data with the "special UDP" syntaxes of SocketWrite and SocketRead.
- SSL sockets: To send or receive data with the SSL protocol, you must create an SSL socket (SocketCreateSSL) and connect to this socket with SocketConnectSSL.
- Communication with robots or with non-WINDEV applications: To simplify the exchanges of data by socket, a transmission mode is initialized by default. For a communication with an external module (non-WINDEV application, robot, ...), this transmission mode can prevent the communications from operating properly. SocketChangeTransmissionMode is used to change this transmission mode (the SocketNoEndTag constant allows you not to modify the frames read and written).
- Websockets: The WebSockets are used to communicate from a Web application (Intranet or Internet site run in a browser) to a Web server by using sockets. SocketConnect is used to connect to the WebSocket server. For more details, see Managing WebSockets.
Reminder: A socket is a communication resource used by applications to communicate from one computer to another regardless of the type of network.
Syntax
Connecting to a WebSocket Hide the details
SocketConnect(<Socket name> , <Address> , <Browser WLanguage procedure> [, <Protocol(s)>])
<Socket name>: Character string Name that will be given when connecting to the server. This name will be used by all socket functions.
Caution: The socket name is case sensitive. <Address>: Character string Address of the WebSocket server that will be used for the connection. This address has the following format: ws[s]://server[:port][/directoryX/.../]. In this case:- the ws prefix indicates that the server is a WebSocket server. wss is used for a secure WebSocket server.
- server corresponds to the server address in the following format: server name, server domain name or IP address.
- port corresponds to the number of the communication port used to dialog with the server. This number must be identical to the port number specified in SocketCreate if the WebSocket server was created in WLanguage with WINDEV or WEBDEV.
- directoryX corresponds to the possible virtual directories of server.
<Browser WLanguage procedure>: Procedure name Name of the WLanguage procedure ("callback") written in browser code. Name of the procedure called when the connection to the server is established. This procedure can be used to send a message to the server with SocketWrite, for example. For more details on this procedure, see Parameters of the procedure used by SocketConnect. <Protocol(s)>: String or array of strings (optional) Protocol(s) corresponding to the format of the WebSocket response. For example: "JSON", "XML". If this parameter is not specified or is an empty string, no protocol is used.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|