def adsSyncWriteReqEx(port, address, index_group, index_offset, value, plc_data_type):<EOL>
sync_write_request = _adsDLL.AdsSyncWriteReqEx<EOL>ams_address_pointer = ctypes.pointer(address.amsAddrStruct())<EOL>index_group_c = ctypes.c_ulong(index_group)<EOL>index_offset_c = ctypes.c_ulong(index_offset)<EOL>if plc_data_type == PLCTYPE_STRING:<EOL><INDENT>data = ctypes.c_char_p(value.encode("<STR_LIT:utf-8>"))<EOL>data_pointer = data  <EOL>data_length = len(data_pointer.value) + <NUM_LIT:1>  <EOL><DEDENT>else:<EOL><INDENT>if type(plc_data_type).__name__ == "<STR_LIT>":<EOL><INDENT>data = plc_data_type(*value)<EOL><DEDENT>else:<EOL><INDENT>data = plc_data_type(value)<EOL><DEDENT>data_pointer = ctypes.pointer(data)<EOL>data_length = ctypes.sizeof(data)<EOL><DEDENT>error_code = sync_write_request(<EOL>port,<EOL>ams_address_pointer,<EOL>index_group_c,<EOL>index_offset_c,<EOL>data_length,<EOL>data_pointer,<EOL>)<EOL>if error_code:<EOL><INDENT>raise ADSError(error_code)<EOL><DEDENT>
Send data synchronous to an ADS-device.

    :param int port: local AMS port as returned by adsPortOpenEx()
    :param pyads.structs.AmsAddr address: local or remote AmsAddr
    :param int indexGroup: PLC storage area, according to the INDEXGROUP
        constants
    :param int index_offset: PLC storage address
    :param value: value to write to the storage address of the PLC
    :param int plc_data_type: type of the data given to the PLC,
        according to PLCTYPE constants