3.7.0 3.6.0 3.5.0 3.4.0 3.3.0 3.2.2 3.2.1 3.2.0 Korean English Chinese Czech Dutch French German Hungarian Italian Japanese Polish Portuguese Spanish
3.7.0 3.6.0 3.5.0 3.4.0 3.3.0 3.2.2 3.2.1 3.2.0 Korean English Chinese Czech Dutch French German Hungarian Italian Japanese Polish Portuguese Spanish

client_socket_write()

Definition

client_socket_write(sock, tx_data)

Features

This function transmits data to the server.

Parameters

Parameter Name

Data Type

Default Value

Description

sock

socket.socket

-

Socket instance returned from client_socket_open()

tx_data

byte

-

Data to be transmitted

  • The data type must be a byte.

  •  Refer to the example below. 

Return

Value

Description

0

Success

-1

The server is not connected.

-2

Server is disconnected, or socket.error occurred during a data transfer

Exception

Exception

Description

DR_Error (DR_ERROR_TYPE)

Parameter data type error occurred

Example

Python
sock = client_socket_open("192.168.137.200", 20002)
 
client_socket_write(sock, b"1234abcd") # b means the byte type.
 
msg = "abcd" # msg is a string variable.
client_socket_write(sock, msg.encode()) # encode() converts a string type to a byte type. 
 
client_socket_close(sock)

Keyword

client / client_ / socket / client_socket / client_socket_