亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tcp.lst

?? VB從入門到精通學(xué)習(xí)教程,寫的非常詳細(xì),非常好
?? LST
?? 第 1 頁 / 共 3 頁
字號:
 226   5                  }
 227   4               }
 228   3            }
 229   2         }
 230   1      }
 231          
 232          
 233          
 234          
 235          //------------------------------------------------------------------------
 236          // This runs every 0.5 seconds.  If the connection has had no activity
 237          // it initiates closing the connection.
 238          //
 239          //------------------------------------------------------------------------
 240          void tcp_inactivity(void)
 241          {
C51 COMPILER V7.10   TCP                                                                   07/24/2008 16:32:11 PAGE 5   

 242   1         UCHAR idata nr;
 243   1         
 244   1         // Look for active connections in the established state
 245   1         for (nr = 0; nr < 5; nr++)
 246   1         {
 247   2            if ((conxn[nr].ipaddr != 0) && 
 248   2                (conxn[nr].state == STATE_ESTABLISHED) &&
 249   2                (conxn[nr].inactivity))
 250   2            {
 251   3               // Decrement the timer and see if it hit 0
 252   3               conxn[nr].inactivity--;
 253   3               if (conxn[nr].inactivity == 0)
 254   3               {
 255   4                  // Inactivity timer has just timed out.
 256   4                  // Initiate close of connection
 257   4                  tcp_send((FLG_ACK | FLG_FIN), 20, nr);
 258   4                  conxn[nr].my_sequence++;    // For my FIN
 259   4                  conxn[nr].state = STATE_FIN_WAIT_1;
 260   4                  if (debug) serial_send("TCP: Entered FIN_WAIT_1 state\r");  
 261   4               }
 262   3            }
 263   2         }
 264   1      }
 265          
 266          
 267          
 268          //------------------------------------------------------------------------
 269          // This handles incoming TCP messages and manages the TCP state machine
 270          // Note - both the SYN and FIN flags consume a sequence number.
 271          // See "TCP/IP Illustrated, Volume 1" Sect 18.6 for info on TCP states
 272          // See "TCP/IP Illustrated, Volume 1" Sect 17.3 for info on flags
 273          //------------------------------------------------------------------------
 274          void tcp_rcve(UCHAR xdata * inbuf, UINT len)
 275          {
 276   1         UCHAR idata i, j, nr;
 277   1         UINT idata result, header_len, data_len;
 278   1         TCP_HEADER xdata * tcp;
 279   1         IP_HEADER xdata * ip;
 280   1         ULONG idata sum;
 281   1         
 282   1         // IP header is always 20 bytes so message starts at index 34      
 283   1         tcp = (TCP_HEADER xdata *)(inbuf + 34);
 284   1         ip = (IP_HEADER xdata *)(inbuf + 14);
 285   1                                         
 286   1              // Compute TCP checksum including 12 byte pseudoheader
 287   1              // Sum source_ipaddr, dest_ipaddr, and entire TCP message 
 288   1              sum = (ULONG)cksum(inbuf + 26, 8 + len);
 289   1                      
 290   1              // Add in the rest of pseudoheader which is
 291   1              // protocol id and TCP segment length
 292   1              sum += (ULONG)0x0006;     
 293   1              sum += (ULONG)len;
 294   1      
 295   1              // In case there was a carry, add it back around
 296   1              result = (UINT)(sum + (sum >> 16));
 297   1                      
 298   1              if (result != 0xFFFF)
 299   1              {
 300   2                      if (debug) serial_send("TCP: Error, bad cksum\r");
 301   2                      return;
 302   2         }
 303   1      
C51 COMPILER V7.10   TCP                                                                   07/24/2008 16:32:11 PAGE 6   

 304   1              if (debug) serial_send("TCP: Msg rcvd with good cksum\r");
 305   1         
 306   1              // See if message is for http server
 307   1              if (tcp->dest_port != HTTP_PORT)        
 308   1         {
 309   2            if (debug)
 310   2            {
 311   3               serial_send("TCP: Error, msg to port ");
 312   3               memset(text, 0, 10);
 313   3               itoa(tcp->dest_port, text, 10);
 314   3               serial_send(text);
 315   3                         serial_send("\r");
 316   3            }
 317   2            tcp_send(FLG_RST, 20, NO_CONNECTION);
 318   2            return;
 319   2         }
 320   1         
 321   1         // Capture sender's IP address and port number
 322   1         sender_ipaddr = ip->source_ipaddr;
 323   1         sender_tcpport = tcp->source_port;
 324   1         
 325   1         // See if the TCP segment is from someone we are already
 326   1         // connected to. 
 327   1         for (i=0; i < 5; i++)
 328   1         {
 329   2            if ((ip->source_ipaddr == conxn[i].ipaddr) &&
 330   2               (tcp->source_port == conxn[i].port))
 331   2            {   
 332   3               nr = i;
 333   3               if (debug) serial_send("TCP: Rcvd msg from existing conxn\r");
 334   3               break;
 335   3            }       
 336   2         }
 337   1         
 338   1         // If i = 5, we are not connected. If it is a SYN then assign
 339   1         // a temporary conection  to it for processing
 340   1         if (i == 5)
 341   1         {
 342   2            if (tcp->flags & FLG_SYN)
 343   2            {
 344   3               // Find first unused connection (one with IP = 0) 
 345   3               for (j=0; j < 5; j++)
 346   3               {
 347   4                  if (conxn[j].ipaddr == 0)
 348   4                  {
 349   5                     nr = j;
 350   5                     // Initialize new connection
 351   5                     conxn[nr].state = STATE_LISTEN;
 352   5                     break;
 353   5                  }
 354   4               }
 355   3            
 356   3               // If all connections are used then drop msg
 357   3               if (j == 5) return;
 358   3               
 359   3               if (debug)
 360   3               {
 361   4                  serial_send("TCP: New connection ");
 362   4                  memset(text, 0, 10);
 363   4                  itoa((UINT)nr, text, 10);
 364   4                  serial_send(text);
 365   4                                 serial_send("\r");
C51 COMPILER V7.10   TCP                                                                   07/24/2008 16:32:11 PAGE 7   

 366   4               }
 367   3            }
 368   2         }
 369   1      
 370   1      
 371   1         // By now we should have a connection number in range of 0-4
 372   1         // Do a check to avoid any chance of exceeding size of struct
 373   1         if (nr > 4)
 374   1         {
 375   2            if (debug) serial_send("TCP: Error in assigning conxn number\r");
 376   2            return;
 377   2         }
 378   1      
 379   1         // Eventually put in protection against wrapping sequence
 380   1         // numbers, for now make the client start over if his
 381   1         // sequence number is close to wrapping
 382   1         if (tcp->sequence > 0xFFFFFF00L) 
 383   1         {
 384   2            if (debug) serial_send("TCP: Rcvd a high sequence number\r");
 385   2                      conxn[nr].ipaddr = 0;                   
 386   2                      tcp_send(FLG_RST, 20, NO_CONNECTION);
 387   2                      return;         
 388   2         }
 389   1                 
 390   1         // Handle messages whose action is mostly independent of state
 391   1         // such as RST, SYN, and segment with no ACK.  That way the
 392   1              // state machine below does not need to worry about it.
 393   1         if (tcp->flags & FLG_RST)
 394   1         {
 395   2            // An RST does not depend on state at all.  And it does
 396   2            // not count as data so do not send an ACK here.  Close
 397   2            // connection
 398   2                      if (debug) serial_send("TCP: Rcvd a reset\r");
 399   2            conxn[nr].ipaddr = 0;
 400   2            return;
 401   2         }
 402   1              
 403   1              else if (tcp->flags & FLG_SYN)
 404   1              {
 405   2                 // A SYN segment only makes sense if connection is in LISTEN 
 406   2                 if ((conxn[nr].state != STATE_LISTEN) &&
 407   2                (conxn[nr].state != STATE_CLOSED))
 408   2                      {
 409   3                              if (debug) serial_send("TCP: Error, rcvd bogus SYN\r");
 410   3                              conxn[nr].ipaddr = 0;                   
 411   3                              tcp_send(FLG_RST, 20, NO_CONNECTION);
 412   3                              return;         
 413   3                      }
 414   2              }
 415   1              
 416   1              else if ((tcp->flags & FLG_ACK) == 0)
 417   1              {
 418   2                      // Incoming segments except SYN or RST must have ACK bit set
 419   2                      // See TCP/IP Illustrated, Vol 2, Page 965
 420   2            // Drop segment but do not send a reset
 421   2                      if (debug) serial_send("TCP: Error, rcvd segment has no ACK\r");
 422   2                      return;
 423   2              }
 424   1                 
 425   1         // Compute length of header including options, and from that
 426   1         // compute length of actual data
 427   1         header_len =  (tcp->flags & 0xF000) >> 10;
C51 COMPILER V7.10   TCP                                                                   07/24/2008 16:32:11 PAGE 8   

 428   1         data_len = len - header_len;
 429   1      
 430   1      
 431   1               
 432   1         // Handle TCP state machine for this connection
 433   1         switch (conxn[nr].state)
 434   1         {
 435   2            case STATE_CLOSED:
 436   2            case STATE_LISTEN:
 437   2                  
 438   2            // If incoming segment contains SYN and no ACK, then handle 
 439   2            if ((tcp->flags & FLG_SYN) && ((tcp->flags & FLG_ACK) == 0))
 440   2            {
 441   3               // Capture his starting sequence number and generate
 442   3               // my starting sequence number
 443   3               // Fill in connection information
 444   3               conxn[nr].ipaddr = ip->source_ipaddr;
 445   3               conxn[nr].port = tcp->source_port;
 446   3               conxn[nr].state = STATE_LISTEN;
 447   3               conxn[nr].his_sequence = 1 + tcp->sequence;
 448   3               conxn[nr].his_ack = tcp->ack_number;
 449   3               
 450   3               // Use system clock for initial sequence number
 451   3               EA = 0;
 452   3               conxn[nr].my_sequence = initial_sequence_nr;
 453   3               initial_sequence_nr += 64000L;
 454   3               EA = 1;                  
 455   3                        
 456   3               // Send header options with the next message
 457   3               // Since timestamps are optional and we do not use

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美国产高清| 欧美va日韩va| 亚洲乱码精品一二三四区日韩在线| 国产麻豆精品视频| 国产亚洲欧美一区在线观看| 成人性生交大片| 国产精品国产自产拍高清av王其| 91麻豆国产福利在线观看| 亚洲婷婷在线视频| 欧美日高清视频| 久久草av在线| 成人免费在线视频| 欧美日韩精品系列| 九九国产精品视频| 国产精品美女久久久久久久久 | 日本不卡高清视频| 欧美zozo另类异族| 波多野结衣91| 五月综合激情婷婷六月色窝| 日韩欧美成人激情| 成人激情小说乱人伦| 亚洲午夜电影在线观看| 精品成人a区在线观看| 波多野结衣中文一区| 日韩综合一区二区| 国产清纯在线一区二区www| 色综合天天综合在线视频| 日韩精品电影在线| 中文无字幕一区二区三区| 色婷婷av一区二区三区大白胸| 蜜臀av一区二区在线免费观看 | 精品sm在线观看| 一本大道久久a久久综合| 老司机精品视频导航| 中文字幕日本不卡| 日韩视频一区二区在线观看| 91在线观看美女| 精品一区二区日韩| 亚洲蜜臀av乱码久久精品蜜桃| 日韩欧美一区二区在线视频| 91视频免费观看| 韩国在线一区二区| 亚洲aⅴ怡春院| 中文字幕成人在线观看| 日韩精品一区二区三区在线| 欧美图片一区二区三区| 成人黄色av电影| 精品在线免费观看| 午夜精品久久一牛影视| 中文字幕亚洲在| 国产日韩欧美在线一区| 日韩欧美一级精品久久| 欧美理论片在线| 色婷婷久久久综合中文字幕 | 在线不卡a资源高清| 91视视频在线直接观看在线看网页在线看| 免费成人在线观看视频| 亚洲福利国产精品| 亚洲人成在线播放网站岛国| 国产欧美日韩视频在线观看| 精品久久久久久久久久久久包黑料| 欧美无乱码久久久免费午夜一区| 色综合网站在线| 99在线精品观看| av电影天堂一区二区在线观看| 国产精品综合久久| 美女一区二区久久| 免费人成黄页网站在线一区二区| 一区二区三区免费在线观看| 亚洲天堂精品在线观看| 最好看的中文字幕久久| 国产精品国产三级国产aⅴ入口| 国产午夜一区二区三区| 精品久久国产字幕高潮| 精品久久国产老人久久综合| 欧美成人女星排名| 精品久久国产97色综合| 精品国产三级电影在线观看| 日韩无一区二区| 久久蜜桃一区二区| 国产蜜臀97一区二区三区| 久久精品视频免费观看| 中文字幕va一区二区三区| 国产欧美一区二区在线| 国产精品久久久99| 最新热久久免费视频| 亚洲欧美偷拍三级| 亚洲一区二区三区激情| 亚洲一区二区中文在线| 亚洲国产日产av| 人人爽香蕉精品| 另类专区欧美蜜桃臀第一页| 国产乱淫av一区二区三区| 国产米奇在线777精品观看| 国产99久久久精品| 99re视频这里只有精品| 欧美亚洲日本一区| 91精品国产综合久久精品图片 | 欧美日韩国产小视频| 日韩欧美在线一区二区三区| 亚洲精品在线一区二区| 国产欧美日韩麻豆91| 亚洲免费观看高清完整版在线观看 | 色婷婷激情久久| 欧美久久一区二区| 精品黑人一区二区三区久久| 国产欧美日本一区视频| 亚洲嫩草精品久久| 男人的天堂久久精品| 成人精品一区二区三区四区| 欧美无砖专区一中文字| 久久亚洲精品小早川怜子| 中文字幕在线一区| 奇米精品一区二区三区在线观看| 国产一区二区不卡在线| 99综合影院在线| 欧美tickling网站挠脚心| 成人免费在线播放视频| 亚洲成av人片在线| 精品影视av免费| 色综合久久中文字幕| 精品国产1区2区3区| 亚洲激情成人在线| 精品无码三级在线观看视频| 色婷婷综合激情| 久久综合九色综合97_久久久| 亚洲精品高清在线观看| 国产一区二区网址| 欧美日韩色综合| 中文字幕不卡在线观看| 日本成人在线电影网| 色999日韩国产欧美一区二区| 精品国产乱码久久久久久夜甘婷婷| 1024亚洲合集| 国产精品一区二区久久不卡| 欧美日韩国产另类一区| 亚洲日本青草视频在线怡红院| 看片网站欧美日韩| 欧美日免费三级在线| 国产精品久久久久久久久快鸭 | 国产欧美日韩在线观看| 欧美aaaaa成人免费观看视频| 色婷婷综合激情| 国产人成一区二区三区影院| 日韩电影在线观看电影| 欧美天堂一区二区三区| 日韩伦理电影网| 国产成人在线影院 | 欧美在线观看视频在线| 国产精品国产自产拍在线| 加勒比av一区二区| 欧美电影在哪看比较好| 亚洲高清视频中文字幕| 一本色道亚洲精品aⅴ| 国产精品激情偷乱一区二区∴| 国产一区二区不卡老阿姨| 欧美一区二区三区视频免费| 亚洲一区二区三区四区在线免费观看 | 不卡一二三区首页| 久久久久国色av免费看影院| 久久69国产一区二区蜜臀| 91精品婷婷国产综合久久 | 久国产精品韩国三级视频| 欧美肥妇free| 日本成人超碰在线观看| 欧美日韩午夜影院| 亚洲成人综合视频| 欧美日韩精品一区二区三区| 亚洲福中文字幕伊人影院| 欧美性猛交xxxx乱大交退制版| 亚洲国产综合视频在线观看| 日本电影亚洲天堂一区| 亚洲男人的天堂av| 91国内精品野花午夜精品| 夜夜精品浪潮av一区二区三区| 99久久国产综合色|国产精品| 亚洲视频香蕉人妖| 在线视频一区二区免费| 婷婷综合五月天| 日韩欧美一区在线观看| 九九久久精品视频| 国产女主播一区| 色综合久久中文综合久久97| 亚洲成人激情av| 欧美一级片在线观看| 国产乱码精品一区二区三区忘忧草| 久久久99精品免费观看| 成人永久免费视频| 亚洲日本电影在线| 欧美久久一区二区| 国产精品资源在线观看| 国产精品视频一二| 色婷婷av一区二区三区之一色屋| 天天综合色天天综合色h| 欧美成人午夜电影| av中文字幕不卡| 天天做天天摸天天爽国产一区| 精品日韩av一区二区| 成人黄色av电影| 视频在线在亚洲|