diff --git a/src/addins/tcp/OPI_TCPClient.zip b/src/addins/tcp/OPI_TCPClient.zip index 5517380b8..c95a023e8 100644 Binary files a/src/addins/tcp/OPI_TCPClient.zip and b/src/addins/tcp/OPI_TCPClient.zip differ diff --git a/src/addins/tcp/src/component/methods.rs b/src/addins/tcp/src/component/methods.rs index 2e7ce5010..36d7e3fbb 100644 --- a/src/addins/tcp/src/component/methods.rs +++ b/src/addins/tcp/src/component/methods.rs @@ -1,5 +1,5 @@ use std::io::{Read, Write}; -use std::net::TcpStream; +use std::net::{Shutdown, TcpStream}; use std::time::{Duration, Instant}; /// Отправляет данные @@ -70,4 +70,9 @@ pub fn receive( pub fn disconnect(add_in: &mut crate::component::AddIn) -> bool { add_in.connection = None; true +} + +/// Закрытие потока записи +pub fn close_output(connection: &mut TcpStream) -> bool { + connection.shutdown(Shutdown::Write).is_ok() } \ No newline at end of file diff --git a/src/addins/tcp/src/component/mod.rs b/src/addins/tcp/src/component/mod.rs index b2c8d96c0..4fe909bd5 100644 --- a/src/addins/tcp/src/component/mod.rs +++ b/src/addins/tcp/src/component/mod.rs @@ -12,7 +12,8 @@ pub const METHODS: &[&[u16]] = &[ name!("Connect"), // 0 name!("Disconnect"), // 1 name!("Read"), // 2 - name!("Send"), // 3 + name!("Send"), // 3 + name!("CloseOutput") // 4 ]; // Число параметров функций компоненты @@ -22,6 +23,7 @@ pub fn get_params_amount(num: usize) -> usize { 1 => 0, 2 => 3, 3 => 2, + 4 => 0, _ => 0, } } @@ -62,6 +64,13 @@ pub fn cal_func(obj: &mut AddIn, num: usize, params: &mut [Variant]) -> Box{ + if let Some(ref mut connection) = obj.connection { + Box::new(methods::close_output(connection)) + } else { + Box::new(false) + } + } _ => Box::new(false), // Неверный номер команды } diff --git a/src/en/OInt/addins/OPI_TCPClient.zip b/src/en/OInt/addins/OPI_TCPClient.zip index 5517380b8..c95a023e8 100644 Binary files a/src/en/OInt/addins/OPI_TCPClient.zip and b/src/en/OInt/addins/OPI_TCPClient.zip differ diff --git a/src/en/OPI/src/CommonTemplates/OPI_TCPClient/Template.addin b/src/en/OPI/src/CommonTemplates/OPI_TCPClient/Template.addin index c92430149..c95a023e8 100644 Binary files a/src/en/OPI/src/CommonTemplates/OPI_TCPClient/Template.addin and b/src/en/OPI/src/CommonTemplates/OPI_TCPClient/Template.addin differ diff --git a/src/ru/OInt/addins/OPI_TCPClient.zip b/src/ru/OInt/addins/OPI_TCPClient.zip index 5517380b8..c95a023e8 100644 Binary files a/src/ru/OInt/addins/OPI_TCPClient.zip and b/src/ru/OInt/addins/OPI_TCPClient.zip differ diff --git a/src/ru/OPI/src/CommonModules/OPI_TCP/Module.bsl b/src/ru/OPI/src/CommonModules/OPI_TCP/Module.bsl index 697c0aade..ce9ccc76f 100644 --- a/src/ru/OPI/src/CommonModules/OPI_TCP/Module.bsl +++ b/src/ru/OPI/src/CommonModules/OPI_TCP/Module.bsl @@ -212,6 +212,7 @@ Соединение = ОткрытьСоединение(Адрес); Результат = ОтправитьДвоичныеДанные(Соединение, Данные); + Соединение.CloseOutput(); Если Результат Тогда diff --git a/src/ru/OPI/src/CommonTemplates/OPI_TCPClient/Template.addin b/src/ru/OPI/src/CommonTemplates/OPI_TCPClient/Template.addin index 5517380b8..c95a023e8 100644 Binary files a/src/ru/OPI/src/CommonTemplates/OPI_TCPClient/Template.addin and b/src/ru/OPI/src/CommonTemplates/OPI_TCPClient/Template.addin differ