Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
a4db3837
Commit
a4db3837
authored
Oct 12, 2010
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ModbusTCP: Исправил ошибку предыдущего коммита
parent
5dbcb71b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
14 deletions
+18
-14
ModbusTCPServer.cc
src/Communications/Modbus/ModbusTCPServer.cc
+18
-14
No files found.
src/Communications/Modbus/ModbusTCPServer.cc
View file @
a4db3837
...
...
@@ -69,20 +69,26 @@ mbErrCode ModbusTCPServer::receive( ModbusRTU::ModbusAddr addr, timeout_t timeou
}
}
// Если получили пакет по TCP
// то вроде задержек с остальной частью быть не должно
// а если пакет, не нам, то обработка пройдёт быстро..
// (поэтому ставим условный timeout)
// не != 0, т.к. в recv стоит assert(timeout)
timeout
=
1
;
do
if
(
!
qrecv
.
empty
()
)
{
// check addr
unsigned
char
_addr
=
qrecv
.
front
();
if
(
_addr
!=
addr
)
{
// buf.addr = curQueryHeader.uID;
// res = recv_pdu(buf,mec);
tmProcessing
.
setTiming
(
replyTimeout_ms
);
ErrorRetMessage
em
(
buf
.
addr
,
buf
.
func
,
erBadReplyNodeAddress
);
buf
=
em
.
transport_msg
();
send
(
buf
);
printProcessingTime
();
usleep
(
1000
);
tcp
.
disconnect
();
return
res
;
}
}
res
=
recv
(
addr
,
buf
,
timeout
);
if
(
res
!=
erNoError
&&
res
!=
erBadReplyNodeAddress
)
if
(
res
!=
erNoError
)
//
&& res!=erBadReplyNodeAddress )
{
if
(
res
<
erInternalErrorCode
)
{
...
...
@@ -92,7 +98,7 @@ mbErrCode ModbusTCPServer::receive( ModbusRTU::ModbusAddr addr, timeout_t timeou
printProcessingTime
();
}
usleep
(
10
000
);
usleep
(
1
000
);
tcp
.
disconnect
();
return
res
;
}
...
...
@@ -106,8 +112,6 @@ mbErrCode ModbusTCPServer::receive( ModbusRTU::ModbusAddr addr, timeout_t timeou
return
erTimeOut
;
}
}
}
while
(
res
==
erBadReplyNodeAddress
);
if
(
res
!=
erNoError
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment