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
4b33b1ce
Commit
4b33b1ce
authored
Dec 21, 2010
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UNet2: исправил ошибку в расчёте длины посылаемого пакета
parent
85c2324a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
2 deletions
+4
-2
UDPPacket.h
extensions/UDPExchange/UDPPacket.h
+1
-0
UNetReceiver.cc
extensions/UDPExchange/UNetReceiver.cc
+2
-1
UNetSender.cc
extensions/UDPExchange/UNetSender.cc
+1
-1
No files found.
extensions/UDPExchange/UDPPacket.h
View file @
4b33b1ce
...
@@ -51,6 +51,7 @@ namespace UniSetUDP
...
@@ -51,6 +51,7 @@ namespace UniSetUDP
inline
bool
isFull
(){
return
count
<
MaxDataCount
;
}
inline
bool
isFull
(){
return
count
<
MaxDataCount
;
}
inline
int
size
(){
return
count
;
}
inline
int
size
(){
return
count
;
}
inline
int
byte_size
(){
return
count
*
sizeof
(
UDPData
);
}
DataPacket
msg
;
DataPacket
msg
;
int
count
;
int
count
;
...
...
extensions/UDPExchange/UNetReceiver.cc
View file @
4b33b1ce
...
@@ -245,7 +245,8 @@ bool UNetReceiver::recv()
...
@@ -245,7 +245,8 @@ bool UNetReceiver::recv()
ssize_t
sz
=
pack
.
msg
.
header
.
dcount
*
sizeof
(
UniSetUDP
::
UDPData
)
+
sizeof
(
UniSetUDP
::
UDPHeader
);
ssize_t
sz
=
pack
.
msg
.
header
.
dcount
*
sizeof
(
UniSetUDP
::
UDPData
)
+
sizeof
(
UniSetUDP
::
UDPHeader
);
if
(
ret
<
sz
)
if
(
ret
<
sz
)
{
{
cerr
<<
myname
<<
"(receive): FAILED data ret="
<<
ret
<<
" sizeof="
<<
sz
<<
endl
;
cerr
<<
myname
<<
"(receive): FAILED data ret="
<<
ret
<<
" sizeof="
<<
sz
<<
" packnum="
<<
pack
.
msg
.
header
.
num
<<
endl
;
return
false
;
return
false
;
}
}
...
...
extensions/UDPExchange/UNetSender.cc
View file @
4b33b1ce
...
@@ -138,7 +138,7 @@ void UNetSender::real_send()
...
@@ -138,7 +138,7 @@ void UNetSender::real_send()
mypack
.
msg
.
header
=
h
;
mypack
.
msg
.
header
=
h
;
// cout << "************* send header: " << mypack.msg.header << endl;
// cout << "************* send header: " << mypack.msg.header << endl;
int
sz
=
mypack
.
size
()
*
sizeof
(
UniSetUDP
::
UDPHeader
);
int
sz
=
mypack
.
byte_size
()
+
sizeof
(
UniSetUDP
::
UDPHeader
);
if
(
udp
->
isPending
(
ost
::
Socket
::
pendingOutput
)
)
if
(
udp
->
isPending
(
ost
::
Socket
::
pendingOutput
)
)
{
{
// ssize_t ret = udp->send( (char*)&(mypack.msg),sizeof(mypack.msg));
// ssize_t ret = udp->send( (char*)&(mypack.msg),sizeof(mypack.msg));
...
...
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