Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
easea
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Arnaud Kress
easea
Commits
79f17d17
Commit
79f17d17
authored
Jun 10, 2014
by
Julien Gamba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switched RECV_DATA to vector to enhance perfomance
parent
c76cc7b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
libeasea/CComUDPLayer.cpp
libeasea/CComUDPLayer.cpp
+5
-4
libeasea/include/CComUDPLayer.h
libeasea/include/CComUDPLayer.h
+3
-2
No files found.
libeasea/CComUDPLayer.cpp
View file @
79f17d17
...
...
@@ -54,10 +54,11 @@ void * CComUDPServer::UDP_server_thread(void *parm) {
printf
(
" Received individual from %s:%d
\n
"
,
inet_ntoa
(
cliaddr
.
sin_addr
),
ntohs
(
cliaddr
.
sin_port
));
pthread_mutex_lock
(
&
server_mutex
);
/*process received data */
memmove
(
p
->
data
[(
*
p
->
nb_data
)].
data
,
buffer
,
sizeof
(
char
)
*
MAXINDSIZE
);
(
*
p
->
nb_data
)
++
;
RECV_DATA
buffer_copy
=
RECV_DATA
(
);
memmove
(
buffer_copy
.
data
,
buffer
,
sizeof
(
char
)
*
MAXINDSIZE
)
;
// printf("address %p\n",(p->data));
p
->
data
=
(
RECV_DATA
*
)
realloc
(
p
->
data
,
sizeof
(
RECV_DATA
)
*
((
*
p
->
nb_data
)
+
1
));
p
->
data
.
push_back
(
buffer_copy
);
(
*
p
->
nb_data
)
++
;
// printf("address %p\n",(p->data));
pthread_mutex_unlock
(
&
server_mutex
);
/*reset receiving buffer*/
...
...
@@ -71,7 +72,7 @@ CComUDPServer::CComUDPServer(unsigned short port,int dg) {
struct
sockaddr_in
ServAddr
;
/* Local address */
debug
=
dg
;
this
->
nb_data
=
0
;
this
->
data
=
(
RECV_DATA
*
)
calloc
(
1
,
sizeof
(
RECV_DATA
));
this
->
data
.
assign
(
sizeof
(
RECV_DATA
),
RECV_DATA
(
));
#ifdef WIN32
WSADATA
wsadata
;
if
(
WSAStartup
(
MAKEWORD
(
1
,
1
),
&
wsadata
)
==
SOCKET_ERROR
)
{
...
...
libeasea/include/CComUDPLayer.h
View file @
79f17d17
...
...
@@ -27,6 +27,7 @@
#include <omp.h>
#endif
#include <string>
#include <vector>
#define _MULTI_THREADED
#define MAXINDSIZE 50000
/*maximum size of an individual in number of characters*/
...
...
@@ -40,7 +41,7 @@ typedef struct {
int
Socket
;
/* Socket descriptor for server */
struct
sockaddr_in
ServAddr
;
/* Local address */
int
debug
;
RECV_DATA
*
data
;
std
::
vector
<
RECV_DATA
>
data
;
int
*
nb_data
;
}
UDP_server_thread_parm_t
;
...
...
@@ -48,7 +49,7 @@ class CComUDPServer {
public:
int
debug
;
RECV_DATA
*
data
;
std
::
vector
<
RECV_DATA
>
data
;
int
nb_data
;
UDP_server_thread_parm_t
*
parm
;
CComUDPServer
(
unsigned
short
port
,
int
dg
);
...
...
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