project2 - RDT3.0 구현
닫기
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
해당 자료는 10페이지 까지만 미리보기를 제공합니다.
10페이지 이후부터 다운로드 후 확인할 수 있습니다.

목차

[Rdt3.0_functions] 7.56kb
  error.c
  in_cksum.c
  Makefile
  np.h
  packet.h
  set_address.c
  tselect.c
  udp_server.c
  udt_send.c


[receiver] 2.06MB
  error.c
  error.o
  in_cksum.c
  in_cksum.o
  Makefile
  np.h
  packet.h
  receiver
  receiver.c
  receiver.o
  Result1.txt
  Result2.jpg
  set_address.c
  set_address.o
  tselect.c
  tselect.o
  udt_send.c
  udt_send.o


[sender] 2.05MB
  error.c
  error.o
  in_cksum.c
  in_cksum.o
  Makefile
  np.h
  packet.h
  sender
  sender.c
  sender.o
  set_address.c
  set_address.o
  Test1.txt
  Test2.jpg
  tselect.c
  tselect.o
  udt_send.c
  udt_send.o

본문내용

#include "np.h"

uint16_t
in_cksum(uint16_t *addr, int len)
{
int nleft = len;
uint32_t sum = 0;
uint16_t *w = addr;
uint16_t answer = 0;

/*
* Our algorithm is simple, using a 32 bit accumulator (sum), we add
* sequential 16 bit words to it, and at the end, fold back all the
* carry bits from the top 16 bits into the lower 16 bits.
*/
while (nleft > 1) {
sum += *w++;
nleft -= 2;
}

/* 4mop up an odd byte, if necessary */
if (nleft == 1) {
*(unsigned char *)(&answer) = *(unsigned char *)w ;
sum += answer;
}

/* 4add back carry outs from top 16 bits to low 16 bits */
sum = (sum >> 16) + (sum & 0xffff); /* add hi 16 to low 16 */
sum += (sum >> 16); /* add carry */
answer = ~sum; /* truncate to 16 bits */
return(answer);
}
  • 가격8,000
  • 페이지수46페이지
  • 등록일2011.11.14
  • 저작시기2011.11
  • 파일형식압축파일(zip)
  • 자료번호#714085
본 자료는 최근 2주간 다운받은 회원이 없습니다.
청소해
다운로드 장바구니