Definition
client_socket_close(sock)
Features
This function terminates communication with the server. To reconnect to the server, the socket must be closed with client_socket_close(sock) and reopened.
Parameters
|
Parameter Name |
Data Type |
Default Value |
Description |
|---|---|---|---|
|
sock |
socket.socket |
- |
Socket instance returned from client_socket_open() |
Return
|
Value |
Description |
|---|---|
|
0 |
Successful disconnection |
Exception
|
Exception |
Description |
|---|---|
|
DR_Error (DR_ERROR_TYPE) |
Parameter data type error occurred |
|
DR_Error (DR_ERROR_RUNTIME) |
socket.error occurred during disconnection |
Example
Python
sock = client_socket_open("192.168.137.200", 20002)
# An indefinite connection is attempted to the server (ip="192.168.137.200", port=20002).
# do something…
client_socket_close(sock) # Closes the connection to the server.