SLIDE 6 6
5/12/02 16
State Transition Diagram
Closed Listen
SYN_RCVD SYN_SENT Established passive open
active open recv: SYN send: SYN+ACK recv: ACK send: nothing data transfer state application: active open send: SYN recv: SYN+ACK send: ACK application: passive open send: nothing Client Server
5/12/02 17
Sliding window
1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 initial window window slides the sender can transmit all packets in the window without waiting for an acknowledgement
5/12/02 18
main(int cc, char **vv) { struct sockaddr_in srv; char buf[BUFSIZ], *addr; int sfd, n; bzero(&srv, sizeof(struct sockaddr_in)); addr = vv[1]; if((sfd = socket(PF_INET, SOCK_STREAM, 0)) < 0) { perror("socket"); exit(1); } if(!isdigit(*addr)) { struct hostent *hp; if((hp = gethostbyname(addr)) == NULL) { fprintf(stderr, "host '%s': not found\n", addr); exit(1); } memcpy((caddr_t *)&srv.sin_addr, hp->h_addr_list[0], hp->h_length); } else srv.sin_addr.s_addr = inet_addr(addr);