Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
HR_Socket_Msg_Demo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
马伊齐
HR_Socket_Msg_Demo
Commits
12008a6a
Commit
12008a6a
authored
Dec 20, 2023
by
马伊齐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成本地发送接收的库
parent
ac54686b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
10 deletions
+9
-10
sock_msg.c
lib/sock_msg.c
+1
-2
sock_msg.h
lib/sock_msg.h
+8
-8
No files found.
lib/sock_msg.c
View file @
12008a6a
...
...
@@ -245,7 +245,6 @@ int msg_local_recv(msg_data_t *msg)
return
-
1
;
}
printf
(
"msgid: %d
\n
"
,
msgid
);
ssize_t
rbytes
=
msgrcv
(
msgid
,
(
void
*
)
msg
,
sizeof
(
msg_data_t
),
0
,
0
);
if
(
rbytes
==
-
1
)
{
...
...
@@ -265,7 +264,7 @@ int msg_local_send(uint16_t type, uint32_t code, void *pad, int len)
}
msg_data_t
msg
;
msg
.
type
=
type
;
msg
.
type
=
(
msg_type_t
)
type
;
msg
.
code
=
code
;
memcpy
(
msg
.
pad
,
pad
,
len
);
msg
.
len
=
len
;
...
...
lib/sock_msg.h
View file @
12008a6a
...
...
@@ -72,14 +72,6 @@ typedef enum
MSG_CHAN_UNKNOWN
,
// 未知通道
}
msg_channel_t
;
typedef
struct
{
msg_type_t
type
;
uint32_t
code
;
int
len
;
char
pad
[
BUFFER_SIZE
];
}
msg_data_t
;
// socket信息结构体
typedef
struct
{
...
...
@@ -88,6 +80,14 @@ typedef struct
uint32_t
mode
;
}
socket_info_t
;
typedef
struct
{
msg_type_t
type
;
uint32_t
code
;
int
len
;
char
pad
[
BUFFER_SIZE
];
}
msg_data_t
;
extern
int
msgid
;
extern
socket_info_t
sockets
[
MAX_CLIENTS
+
1
];
...
...
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