这篇教程C++ uip_send函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中uip_send函数的典型用法代码示例。如果您正苦于以下问题:C++ uip_send函数的具体用法?C++ uip_send怎么用?C++ uip_send使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了uip_send函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: example2_appvoid example2_app(void) {struct example2_state *s; s = (struct example2_state *)uip_conn->appstate; if(uip_connected()) { s->state = WELCOME_SENT; uip_send("Welcome!/n", 9);return;} if(uip_acked() && s->state == WELCOME_SENT) { s->state = WELCOME_ACKED; } if(uip_newdata()) { uip_send("ok1/n", 4); led_on();// while(1); led_off(); } if(uip_rexmit()) { switch(s->state) { case WELCOME_SENT: uip_send("Welcome!/n", 9); break; case WELCOME_ACKED: uip_send("ok2/n", 4); break; } }}
开发者ID:tuteng,项目名称:uip,代码行数:28,
示例2: tty_vt100_mainstatic voidtty_vt100_main (void){ if (uip_connected()) STATE->send_all = 1; if (uip_acked()) { if (STATE->send_all) STATE->send_all = 0; STATE->acked = STATE->sent; } if (uip_newdata ()) { uint8_t len = uip_len; for (uint8_t i = 0; i < len; i ++) { int8_t ch = ((char *) uip_appdata)[i]; if (ch == 12) /* C-l, retransmit everything. */ { STATE->send_all = 1; continue; } _getch_queue (ch); } } if (uip_rexmit() || uip_newdata() || uip_acked() || uip_connected() || uip_poll()) { /* Send new data, if any. */ if (STATE->send_all) tty_vt100_send_all (); else { /* we're just sending an update, ... */ if (vt100_head > STATE->acked) { uint8_t len = vt100_head - STATE->acked; memcpy (uip_sappdata, STATE->acked, len); uip_send (uip_sappdata, len); } else if (vt100_head < STATE->acked) { /* vt100_head wrapped around, let's be careful. */ uint8_t len = vt100_end - STATE->acked; memcpy (uip_sappdata, STATE->acked, len); uint8_t len2 = vt100_head - vt100_buf; memcpy (uip_sappdata + len, vt100_buf, len2); uip_send (uip_sappdata, len + len2); } STATE->sent = vt100_head; } }}
开发者ID:simeonfelis,项目名称:ethersex,代码行数:60,
示例3: data_is_sent_and_acked/*---------------------------------------------------------------------------*/static chardata_is_sent_and_acked(CC_REGISTER_ARG struct psock *s){ /* If data has previously been sent, and the data has been acked, we increase the send pointer and call send_data() to send more data. */ if(s->state != STATE_DATA_SENT || uip_rexmit()) { if(s->sendlen > uip_mss()) { uip_send(s->sendptr, uip_mss()); } else { uip_send(s->sendptr, s->sendlen); } s->state = STATE_DATA_SENT; return 0; } else if(s->state == STATE_DATA_SENT && uip_acked()) { if(s->sendlen > uip_mss()) { s->sendlen -= uip_mss(); s->sendptr += uip_mss(); } else { s->sendptr += s->sendlen; s->sendlen = 0; } s->state = STATE_ACKED; return 1; } return 0;}
开发者ID:DIYzzuzpb,项目名称:contiki-mplabx,代码行数:28,
示例4: example2_app/***************************************************************************** 函 数 名 : example2_app 功能描述 : just a example function for tcp connect 输入参数 : void 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2017年4月17日 作 者 : QSWWD 修改内容 : 新生成函数*****************************************************************************/static void example2_app(void) { struct example2_state *s; s = (struct example2_state *)uip_conn->appstate; if(uip_connected()) { s->state = WELCOME_SENT; uip_send("Welcome!/n/r", 10); return; } if(uip_acked() && s->state == WELCOME_SENT) { s->state = WELCOME_ACKED; } if(uip_newdata()) { uip_send("ok!You are trying to connect to UIP./n/r", 43); } if(uip_rexmit()) { switch(s->state) { case WELCOME_SENT: uip_send("Welcome,the rexmit!/n/r", 20); break; case WELCOME_ACKED: uip_send("ok!this is retransmit./n/r",30); break; default: uip_send("the rexmit ,Your's command is something error./n/r", 50); break; } }}
开发者ID:haikong,项目名称:haikong.github.io,代码行数:44,
示例5: lp_tcp_appcallvoid lp_tcp_appcall(void) { struct lp_tcp_state *s; s = &(uip_conn->appstate); if (uip_connected()) { s->state = WELCOME_SENT; uip_send("Handshake complete!/n", 20); return; } if (uip_acked() && s->state == WELCOME_SENT) { s->state = WELCOME_ACKED; } if (uip_newdata()) { P1OUT ^= BIT0; uip_send("Received packet/n", 16); } if (uip_rexmit()) { switch(s->state) { case WELCOME_SENT: uip_send("Handshake complete!/n", 20); break; case WELCOME_ACKED: uip_send("Received packet/n", 16); break; } }}
开发者ID:YuchenJ,项目名称:lp-tcp,代码行数:31,
示例6: yport_net_mainvoid yport_net_main(void){ if(uip_connected()) { if (yport_conn == NULL) { yport_conn = uip_conn; uip_conn->wnd = YPORT_BUFFER_LEN - 1; } else /* if we have already an connection, send an error */ uip_send("ERROR: Connection blocked/n", 27); } else if (uip_acked()) { /* If the peer is not our connection, close it */ if (yport_conn != uip_conn) uip_close(); else { /* Some data we have sent was acked, jipphie */ /* disable interrupts */ uint8_t sreg = SREG; cli(); yport_recv_buffer.len -= yport_recv_buffer.sent; /* We should use memmove, because the data may overlap */ memmove(yport_recv_buffer.data, yport_recv_buffer.data + yport_recv_buffer.sent, yport_recv_buffer.len); /* enable interrupts again */ SREG = sreg; } } else if (uip_closed() || uip_aborted() || uip_timedout()) { /* if the closed connection was our connection, clean yport_conn */ if (yport_conn == uip_conn) yport_conn = NULL; } else if (uip_newdata()) { if (uip_len <= YPORT_BUFFER_LEN && yport_rxstart(uip_appdata, uip_len) != 0) { /* Prevent the other side from sending more data */ uip_stop(); } } if (uip_poll() && uip_conn == yport_conn && uip_stopped(yport_conn) && yport_send_buffer.sent == yport_send_buffer.len) uip_restart(); /* Send data */ if ((uip_poll() || uip_acked() || uip_rexmit()) && yport_conn == uip_conn && yport_recv_buffer.len > 0) { /* We have recieved data, lets propagade it */ /* disable interrupts */ uint8_t sreg = SREG; cli(); /* Send the data */ uip_send(yport_recv_buffer.data, yport_recv_buffer.len); /* so many data was send */ yport_recv_buffer.sent = yport_recv_buffer.len; /* enable interrupts again */ SREG = sreg; }}
开发者ID:muccc,项目名称:matemat,代码行数:58,
示例7: UIP_UDP_APPCALLvoid UIP_UDP_APPCALL(void) { if (uip_flags & UIP_NEWDATA) { printf("UDP: UIP NEWDATA"); if (uip_udp_conn == bc_conn) printf("oops, this should not happen..."); if (uip_udp_conn == app_conn) appHandlePacket();#ifdef USE_DHCPD if (uip_udp_conn == dhcpd_request_conn) dhcpdHandlePacket(); if (uip_udp_conn == dhcpd_reply_conn) { printf("packet to the reply connection?!?"); while (1); }#endif return; } if (uip_flags & UIP_POLL) {#ifdef USE_UDP if (state==CONNECTED && udp_disconnected==0) { state = NOT_CONNECTED; //lcdClear(); //lcdGoto(0); uint8_t* msg = "disconnected"; int i; //for (i=0; msg[i]; i++) lcdPrintChar(msg[i]); } //printf("{{{UDP: UIP POLL}}}"); if (state==NOT_CONNECTED && uip_udp_conn == bc_conn) { /* UIP does not know about UDP broadcasts, so we fix the ARP table manually * This function is declared static by default, so it needs to be made non-static to * call from here. */ uip_arp_update(&dhcpd_broadcast_ipaddr, &broadcast_ethaddr); uip_send("iLPC2148 Education Board/0", 25); udp_sync = 1000; /* send sync in one second */ //((uint8_t*) uip_appdata)[0] = 0; //uip_send(uip_appdata, 1); printf("<<< sending udp info packet >>>"); return; } if (state==CONNECTED && uip_udp_conn == app_conn) { if (state_change) { ((uint8_t*)uip_appdata)[0] = 's'; ((uint8_t*)uip_appdata)[1] = (uint8_t) switch14; uip_send(uip_appdata, 2); udp_sync = 1000; /* send sync in one second */ printf("<<< sending udp state packet >>>"); return; } if (udp_sync==0) { uip_send("h", 1); /* heartbeat */ udp_sync = 1000; /* send sync in one second */ } }#endif if (uip_udp_conn == dhcpd_reply_conn) dhcpdPollHandler(); return; }}
开发者ID:EFraim,项目名称:trans-vpn,代码行数:58,
示例8: telnet_handle_packet |