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
f23796d1
Commit
f23796d1
authored
Apr 20, 2011
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unet2-tester: Добавил новый параметр для проверки последовательности приходящих пакетов.
parent
9ea8e056
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
unet2-tester.cc
extensions/UNet2/unet2-tester.cc
+18
-1
No files found.
extensions/UNet2/unet2-tester.cc
View file @
f23796d1
...
...
@@ -16,6 +16,7 @@ static struct option longopts[] = {
{
"timeout"
,
required_argument
,
0
,
't'
},
{
"data-count"
,
required_argument
,
0
,
'c'
},
{
"disable-broadcast"
,
no_argument
,
0
,
'b'
},
{
"check-lost"
,
no_argument
,
0
,
'l'
},
{
"verbode"
,
required_argument
,
0
,
'v'
},
{
NULL
,
0
,
0
,
0
}
};
...
...
@@ -58,8 +59,9 @@ int main(int argc, char* argv[])
int
procID
=
1
;
int
nodeID
=
1
;
int
count
=
50
;
bool
lost
=
false
;
while
(
(
opt
=
getopt_long
(
argc
,
argv
,
"hs:r:vp:n:t
b:
"
,
longopts
,
&
optindex
))
!=
-
1
)
while
(
(
opt
=
getopt_long
(
argc
,
argv
,
"hs:r:vp:n:t
:bx:l
"
,
longopts
,
&
optindex
))
!=
-
1
)
{
switch
(
opt
)
{
...
...
@@ -73,6 +75,7 @@ int main(int argc, char* argv[])
cout
<<
"[-t|--timeout] msec - timeout for receive. Default: 0 msec (waitup)."
<<
endl
;
cout
<<
"[-x|--send-pause] msec - pause for send packets. Default: 200 msec."
<<
endl
;
cout
<<
"[-b|--disable-broadcast] - Disable broadcast mode."
<<
endl
;
cout
<<
"[-l|--check-lost] - Check the lost packets."
<<
endl
;
cout
<<
"[-v|--verbose] - verbose mode."
<<
endl
;
cout
<<
endl
;
return
0
;
...
...
@@ -111,6 +114,10 @@ int main(int argc, char* argv[])
broadcast
=
false
;
break
;
case
'l'
:
lost
=
true
;
break
;
case
'v'
:
verb
=
1
;
break
;
...
...
@@ -167,6 +174,7 @@ int main(int argc, char* argv[])
// char buf[UniSetUDP::MaxDataLen];
UniSetUDP
::
UDPMessage
pack
;
unsigned
long
prev_num
=
1
;
while
(
1
)
{
...
...
@@ -194,6 +202,15 @@ int main(int argc, char* argv[])
continue
;
}
if
(
lost
)
{
if
(
prev_num
!=
(
pack
.
msg
.
header
.
num
-
1
)
)
cerr
<<
"WARNING! Incorrect sequence of packets! current="
<<
pack
.
msg
.
header
.
num
<<
" prev="
<<
prev_num
<<
endl
;
prev_num
=
pack
.
msg
.
header
.
num
;
}
if
(
verb
)
cout
<<
"receive OK. header: "
<<
pack
.
msg
.
header
<<
endl
;
}
...
...
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