Commit 12008a6a authored by 马伊齐's avatar 马伊齐

完成本地发送接收的库

parent ac54686b
......@@ -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;
......
......@@ -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];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment