|
#include"stdio.h"
#include"string.h"
#include"stdlib.h"
#include"time.h"
#define MAX_PKT 1024
#define MAX_SEQ 7
typedef enum {FALSE, TRUE} boolean;
typedef unsigned int seq_nr;
typedef enum {dat, ack, nak} frame_kind;
typedef enum event_type {timeout, frame_arrival};
typedef struct
{ frame_kind kind;
seq_nr seq;
seq_nr ack;
char info[1024];
} frame;
void from_network_layer(frame *r)
{
frame fra;
r = &fra ;
printf("输入信息:");
memset(fra.info, 0, strlen(fra.info));
for(int i = 0; ; i++)
{
fra.info[i] = getchar();
if ('\n' == fra.info[i])
{
fra.info[++i] = '\0';
break;
}
}
}
void main()
{
seq_nr ack = 0;
frame send, rev;
event_type event;
from_network_layer(&send);
send.kind = dat;
}
为什么SEND得不到from_network_layer形成的FRA.INFO |
|