这篇教程C++ uip_connected函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中uip_connected函数的典型用法代码示例。如果您正苦于以下问题:C++ uip_connected函数的具体用法?C++ uip_connected怎么用?C++ uip_connected使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了uip_connected函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: 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,
示例2: telnetd_appcall/*---------------------------------------------------------------------------*/voidtelnetd_appcall(void *ts){ if(uip_connected()) { tcp_markconn(uip_conn, &s); buf_init(&buf); s.bufptr = 0; s.state = STATE_NORMAL; shell_start(); } if(s.state == STATE_CLOSE) { s.state = STATE_NORMAL; uip_close(); return; } if(uip_closed() || uip_aborted() || uip_timedout()) { closed(); } if(uip_acked()) { acked(); } if(uip_newdata()) { newdata(); } if(uip_rexmit() || uip_newdata() || uip_acked() || uip_connected() || uip_poll()) { senddata(); }}
开发者ID:EDAyele,项目名称:ptunes,代码行数:36,
示例3: tcp_server_demo_appcall//这是一个TCP 服务器应用回调函数。//该函数通过UIP_APPCALL(tcp_demo_appcall)调用,实现Web Server的功能.//当uip事件发生时,UIP_APPCALL函数会被调用,根据所属端口(1200),确定是否执行该函数。//例如 : 当一个TCP连接被创建时、有新的数据到达、数据已经被应答、数据需要重发等事件void tcp_server_demo_appcall(void){ struct tcp_demo_appstate *s = (struct tcp_demo_appstate *)&uip_conn->appstate; if(uip_aborted())tcp_server_aborted(); //连接终止 if(uip_timedout())tcp_server_timedout(); //连接超时 if(uip_closed())tcp_server_closed(); //连接关闭 if(uip_connected())tcp_server_connected(); //连接成功 if(uip_acked())tcp_server_acked(); //发送的数据成功送达 //接收到一个新的TCP数据包 if (uip_newdata())//收到客户端发过来的数据 { if((tcp_server_sta&(1<<6))==0)//还未收到数据 { if(uip_len>199) { ((uint8_t*)uip_appdata)[199]=0; } strcpy((char*)tcp_server_databuf,uip_appdata); tcp_server_sta|=1<<6;//表示收到客户端数据 } }else if(tcp_server_sta&(1<<5))//有数据需要发送 { s->textptr=tcp_server_databuf; s->textlen=strlen((const char*)tcp_server_databuf); tcp_server_sta&=~(1<<5);//清除标记 } //当需要重发、新数据到达、数据包送达、连接建立时,通知uip发送数据 if(uip_rexmit()||uip_newdata()||uip_acked()||uip_connected()||uip_poll()) { tcp_server_senddata(); }}
开发者ID:RdMaxes,项目名称:stm32f103_uIP_ENC28J60,代码行数:36,
示例4: irc_mainstatic voidirc_main(void){ if (uip_aborted() || uip_timedout()) { IRCDEBUG ("connection aborted/n"); irc_conn = NULL; } if (uip_closed()) { IRCDEBUG ("connection closed/n"); irc_conn = NULL; } if (uip_connected()) { IRCDEBUG ("new connection/n"); STATE->stage = IRC_SEND_USERNICK; STATE->sent = IRC_SEND_INIT;#ifdef ECMD_IRC_SUPPORT STATE->reparse = 0;#endif *STATE->outbuf = 0; } if (STATE->stage == IRC_SEND_JOIN && uip_acked ()) STATE->stage ++; else if (STATE->stage == IRC_CONNECTED && uip_acked ()) { *STATE->outbuf = 0;#ifdef ECMD_IRC_SUPPORT if (STATE->reparse) irc_handle_ecmd ();#endif } else if (uip_newdata() && uip_len) { ((char *) uip_appdata)[uip_len] = 0; IRCDEBUG ("received data: %s/n", uip_appdata); if (irc_parse ()) { uip_close (); /* Parse error */ return; } } if (uip_rexmit ()) irc_send_data (STATE->sent); else if ((STATE->stage > STATE->sent || STATE->stage == IRC_CONNECTED) && (uip_newdata() || uip_acked() || uip_connected())) irc_send_data (STATE->stage); else if (STATE->stage == IRC_CONNECTED && uip_poll() && *STATE->outbuf) irc_send_data (STATE->stage);}
开发者ID:HansBaechle,项目名称:ethersex,代码行数:59,
示例5: httpd_mainvoidhttpd_main(void){ if (uip_aborted() || uip_timedout()) { printf("httpd: connection aborted/n"); httpd_cleanup(); return; } if (uip_closed()) { printf("httpd: connection closed/n"); httpd_cleanup(); return; } if (uip_connected()) { printf("httpd: new connection/n"); /* initialize struct */ STATE->handler = NULL; STATE->header_acked = 0; STATE->eof = 0; STATE->header_reparse = 0;#ifdef HTTPD_AUTH_SUPPORT STATE->auth_state = PAM_UNKOWN;#endif } if (uip_newdata() && (!STATE->handler || STATE->header_reparse)) { printf("httpd: new data/n"); httpd_handle_input(); }#ifdef HTTPD_AUTH_SUPPORT if (STATE->auth_state == PAM_DENIED && STATE->handler != httpd_handle_401) { httpd_cleanup(); STATE->handler = httpd_handle_401; STATE->header_reparse = 0; printf("httpd: auth failed/n"); } else if (STATE->auth_state == PAM_PENDING) return; /* Waiting for the PAM Layer */#endif if (uip_rexmit() || uip_newdata() || uip_acked() || uip_poll() || uip_connected()) { /* Call associated handler, if set already. */ if (STATE->handler && (!STATE->header_reparse)) STATE->handler(); }}
开发者ID:AnDann,项目名称:ethersex,代码行数:59,
示例6: jabber_mainstatic voidjabber_main(void){ if (uip_aborted() || uip_timedout()) { JABDEBUG("connection aborted/n"); jabber_conn = NULL; } if (uip_closed()) { JABDEBUG("connection closed/n"); jabber_conn = NULL; } if (uip_connected()) { JABDEBUG("new connection/n"); STATE->stage = JABBER_OPEN_STREAM; STATE->sent = JABBER_INIT;#ifdef JABBER_STARTUP_MESSAGE_SUPPORT strncpy_P(STATE->target, PSTR(CONF_JABBER_BUDDY), sizeof(STATE->target)); strncpy_P(STATE->outbuf, jabber_startup_text, sizeof(STATE->outbuf)); STATE->action = JABBER_ACTION_MESSAGE;#endif /* JABBER_STARTUP_MESSAGE_SUPPORT */ } if (uip_acked() && STATE->stage == JABBER_CONNECTED) { STATE->action = JABBER_ACTION_NONE; *STATE->outbuf = 0; } if (uip_newdata() && uip_len) { /* Zero-terminate */ ((char *) uip_appdata)[uip_len] = 0; JABDEBUG("received data: %s/n", uip_appdata); if (jabber_parse()) { uip_close(); /* Parse error */ return; } } if (uip_rexmit()) jabber_send_data(STATE->stage, STATE->action); else if ((STATE->stage > STATE->sent || STATE->stage == JABBER_CONNECTED) && (uip_newdata() || uip_acked() || uip_connected())) jabber_send_data(STATE->stage, STATE->action); else if (STATE->stage == JABBER_CONNECTED && uip_poll() && STATE->action) jabber_send_data(STATE->stage, STATE->action);}
开发者ID:AnDann,项目名称:ethersex,代码行数:57,
示例7: telnetd_appcall/*---------------------------------------------------------------------------*/voidtelnetd_appcall(void *ts){ if(uip_connected()) { if(!connected) { buf_init(&buf); s.bufptr = 0; s.state = STATE_NORMAL; connected = 1; shell_start(); timer_set(&s.silence_timer, MAX_SILENCE_TIME); ts = (char *)0; } else { uip_send(telnetd_reject_text, strlen(telnetd_reject_text)); ts = (char *)1; } tcp_markconn(uip_conn, ts); } if(!ts) { if(s.state == STATE_CLOSE) { s.state = STATE_NORMAL; uip_close(); return; } if(uip_closed() || uip_aborted() || uip_timedout()) { shell_stop(); connected = 0; } if(uip_acked()) { timer_set(&s.silence_timer, MAX_SILENCE_TIME); acked(); } if(uip_newdata()) { timer_set(&s.silence_timer, MAX_SILENCE_TIME); newdata(); } if(uip_rexmit() || uip_newdata() || uip_acked() || uip_connected() || uip_poll()) { senddata(); if(s.numsent > 0) { timer_set(&s.silence_timer, MAX_SILENCE_TIME); } } if(uip_poll()) { if(timer_expired(&s.silence_timer)) { uip_close(); tcp_markconn(uip_conn, NULL); } } }}
开发者ID:Abdellazizhammami,项目名称:contiki,代码行数:58,
示例8: mysql_mainstatic voidmysql_main(void){ if (uip_aborted() || uip_timedout()) { MYDEBUG ("connection aborted/n"); mysql_conn = NULL; } if (uip_closed()) { MYDEBUG ("connection closed/n"); mysql_conn = NULL; } if (uip_connected()) { MYDEBUG ("new connection/n"); STATE->stage = MYSQL_WAIT_GREETING; STATE->sent = MYSQL_WAIT_GREETING; STATE->packetid = 0; } if (uip_newdata() && uip_len) {#ifdef DEBUG_MYSQL MYDEBUG ("received data: %s/n", uip_appdata); for (uint16_t i = 0; i < uip_len; i ++) debug_putchar (((unsigned char *) uip_appdata)[i]); debug_putchar (10);#endif if (mysql_parse ()) { uip_close (); /* Parse error */ return; } } if (uip_rexmit()) { STATE->packetid --; mysql_send_data (STATE->sent); } else if ((STATE->stage > STATE->sent || STATE->stage == MYSQL_CONNECTED) && (uip_newdata() || uip_acked() || uip_connected())) mysql_send_data (STATE->stage); else if (STATE->stage == MYSQL_CONNECTED && uip_poll() && *STATE->u.stmtbuf) mysql_send_data(STATE->stage);}
开发者ID:simeonfelis,项目名称:ethersex,代码行数:48,
示例9: contiki_appcallstatic void contiki_appcall(void *data){ contiki_data_t *s = (contiki_data_t *)data; if (uip_closed() || uip_aborted() || uip_timedout()) { //xprintf("closed or aborted or timedout/n"); if (s->state == READING || s->state == WRITTING) { s->state = ERROR; } else { s->state = CLOSED; } process_post_synch(s->process, xively_event, s); } else if (uip_connected()) { s->state = CONNECTED; PSOCK_INIT(&s->p, NULL, 0); process_post_synch(s->process, xively_event, s); } else if (uip_newdata()) { if (s->state == READING) { s->state = READ_END; process_post_synch(s->process, xively_event, s); } } if (s->state == CLOSING) { uip_close(); } handle_output(s);}
开发者ID:foss-for-synopsys-dwc-arc-processors,项目名称:libxively,代码行数:27,
示例10: hello_world_appcallstatic int hello_world_appcall(void){ struct tcp_hello_appstate *s = &(uip_conn->appstate.tcp_hello); if(uip_connected()) { PSOCK_INIT(&s->p, s->inputbuffer, sizeof(s->inputbuffer)); } PSOCK_BEGIN(&s->p); PSOCK_SEND_STR(&s->p, "Hello. What is your name?/n"); PSOCK_READTO(&s->p, '/n'); strncpy(s->name, s->inputbuffer, sizeof(s->name)); s->name[strlen(s->name)-2] = 0; PSOCK_SEND_STR(&s->p, "Hello "); PSOCK_SEND_STR(&s->p, s->name); PSOCK_SEND_STR(&s->p, " !/n"); sprintf(s->name, "r %d/%d", nrf_link_get_rx_packets(), nrf_link_get_rx_dropped()); PSOCK_SEND_STR(&s->p, s->name); PSOCK_SEND_STR(&s->p, " "); sprintf(s->name, "t %d/%d", nrf_link_get_tx_packets(), nrf_link_get_tx_dropped()); PSOCK_SEND_STR(&s->p, s->name); PSOCK_SEND_STR(&s->p, "/n/r"); PSOCK_CLOSE(&s->p); PSOCK_END(&s->p);}
开发者ID:codywon,项目名称:nrf24l01_wsn,代码行数:25,
示例11: uipcall/*---------------------------------------------------------------------*/static voiduipcall(void *state){ if(uip_udpconnection()) { recv_udpthread(&s.recv_udpthread_pt); send_udpthread(&s.udpthread_pt); } else { if(uip_conn->lport == HTONS(CODEPROP_DATA_PORT)) { if(uip_connected()) { if(state == NULL) { s.addr = 0; s.count = 0; PT_INIT(&s.tcpthread_pt); process_poll(&codeprop_process); tcp_markconn(uip_conn, &s);/* process_post(PROCESS_BROADCAST, codeprop_event_quit, *//* (process_data_t)NULL); */ } else { PRINTF(("codeprop: uip_connected() and state != NULL/n")); uip_abort(); } } recv_tcpthread(&s.tcpthread_pt); if(uip_closed() || uip_aborted() || uip_timedout()) { PRINTF(("codeprop: connection down/n")); tcp_markconn(uip_conn, NULL); } } }}
开发者ID:EDAyele,项目名称:ptunes,代码行数:34,
示例12: PROCESS_THREADPROCESS_THREAD(server_process, ev, data){ PROCESS_BEGIN(); set_global_address(); leds_init(); print_local_addresses(); printf("Starting TCP server on port=%d/n", PORT); tcp_listen(UIP_HTONS(PORT)); while(1) { PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); if(uip_aborted() ) printf("TCP aborted/n"); if(uip_timedout() ) printf("TCP timeoutn/n"); if(uip_closed() ) printf("TCP closed/n"); if(uip_connected()) { printf("TCP Connected/n/r"); PSOCK_INIT(&ps, buf, sizeof(buf)); while(!(uip_aborted() || uip_closed() || uip_timedout())) { PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); handle_connection(&ps); } } } PROCESS_END();}
开发者ID:1847123212,项目名称:contiki,代码行数:32,
示例13: uip_task_appcallvoid uip_task_appcall(){ if(uip_connected()) { socket_process_new_connect_(); }else if(uip_poll()) { if(uip_stopped(uip_conn)) { socket_process_try_restart_(); } socket_process_write_(); }else if(uip_newdata()) { socket_process_new_data_(); socket_process_write_(); }else if(uip_aborted() || uip_closed()) { socket_process_close_(); }else if(uip_timedout()) { socket_process_timeout_(); uip_close(); }else if(uip_acked() || uip_rexmit()) { socket_process_write_(); }}
开发者ID:jayaraj-poroor,项目名称:freertos-uip-kernel,代码行数:34,
示例14: PROCESS_THREAD/* -------------------------------------------------------------------------- */PROCESS_THREAD(example_psock_server_process, ev, data){ // The Start... PROCESS_BEGIN(); // So, here we configure the network listening at a TCP port. tcp_listen(UIP_HTONS(12345)); while (1) { // Wait a TCP / IP event... PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); // If someone has connected, let's init the connection if (uip_connected()) { // Bind the buffer to the socket PSOCK_INIT(&socket, buffer, sizeof(buffer)); // So now, let's keep the connection open waiting for something while (!(uip_aborted() || uip_closed() || uip_timedout())) { // Wait for an TCIP / IP event PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); // And then, let's send to handle the data handle_connection(&socket); } } } // ... the End PROCESS_END();}
开发者ID:RauPerez25,项目名称:Wall-E,代码行数:32,
示例15: hello_world_appcall /* * In hello-world.h we have defined the UIP_APPCALL macro to * hello_world_appcall so that this funcion is uIP's application * function. This function is called whenever an uIP event occurs * (e.g. when a new connection is established, new data arrives, sent * data is acknowledged, data needs to be retransmitted, etc.). */ void hello_world_appcall(void) { /* * The uip_conn structure has a field called "appstate" that holds * the application state of the connection. We make a pointer to * this to access it easier. */ struct hello_world_state *s = &(uip_conn->appstate); /* * If a new connection was just established, we should initialize * the protosocket in our applications' state structure. */ if(uip_connected()) { PSOCK_INIT(&p, s->inputbuffer, sizeof(s->inputbuffer)); } /* * Finally, we run the protosocket function that actually handles * the communication. We pass it a pointer to the application state * of the current connection. */ handle_connection(s); }
开发者ID:marcotuliogm,项目名称:mult-UIP,代码行数:32,
示例16: 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,
示例17: uip_modbus_appcallvoid uip_modbus_appcall(void){ if(uip_connected()) { PRINTF("connected!/r/n"); } if(uip_closed()) { PRINTF("closed/r/n"); } if(uip_newdata()) { PRINTF("request!/r/n"); // 获得modbus请求 memcpy(ucTCPRequestFrame, uip_appdata, uip_len ); ucTCPRequestLen = uip_len; // 向 modbus poll发送消息 xMBPortEventPost( EV_FRAME_RECEIVED ); } if(uip_poll()) { if(bFrameSent) { bFrameSent = FALSE; // uIP发送Modbus应答数据包 uip_send( ucTCPResponseFrame , ucTCPResponseLen ); } }}
开发者ID:kc87654321,项目名称:uip_freemodbus_tcp,代码行数:32,
示例18: 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,
示例19: PROCESS_THREAD/*---------------------------------------------------------------------*/PROCESS_THREAD(tcp_loader_process, ev, data){ PROCESS_BEGIN(); tcp_listen(HTONS(CODEPROP_DATA_PORT)); while(1) { PROCESS_YIELD(); if(ev == tcpip_event && uip_conn->lport == HTONS(CODEPROP_DATA_PORT)) { if(uip_connected()) { /* Really uip_connecting()!!! */ if(data == NULL) { PT_INIT(&s.tcpthread_pt); process_poll(&tcp_loader_process); tcp_markconn(uip_conn, &s); } else { PRINTF(("codeprop: uip_connected() and data != NULL/n")); uip_abort(); } } recv_tcpthread(&s.tcpthread_pt); /* Run thread */ if(uip_closed() || uip_aborted() || uip_timedout()) { PRINTF(("codeprop: connection down/n")); tcp_markconn(uip_conn, NULL); } } } PROCESS_END();}
开发者ID:EDAyele,项目名称:ptunes,代码行数:31,
示例20: PROCESS_THREAD/*---------------------------------------------------------------------------*/PROCESS_THREAD(example_psock_client_process, ev, data){ uip_ipaddr_t addr; printf("%d/n", TEST); PROCESS_BEGIN(); uip_ipaddr(addr, 192,168,2,1); tcp_connect(addr, UIP_HTONS(80), NULL); printf("Connecting.../n"); PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); if(uip_aborted() || uip_timedout() || uip_closed()) { printf("Could not establish connection/n"); } else if(uip_connected()) { printf("Connected/n"); PSOCK_INIT(&ps, buffer, sizeof(buffer)); do { handle_connection(&ps); PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); } while(!(uip_closed() || uip_aborted() || uip_timedout())); printf("/nConnection closed./n"); } PROCESS_END();}
开发者ID:1uk3,项目名称:contiki,代码行数:31,
示例21: PROCESS_THREAD/*---------------------------------------------------------------------------*/PROCESS_THREAD(server_process, ev, data){ PROCESS_BEGIN(); u16_t hostport = 7777; printf("TCP listen on %d.%d.%d.%d:%u/n", uip_ipaddr_to_quad(&uip_hostaddr), hostport); tcp_listen(uip_htons(hostport)); while(1) { PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); if (uip_connected()) { printf("server: client arrived!/n"); connected = 1; while (!(uip_aborted() || uip_closed() || uip_timedout())) { PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); } if (uip_aborted() || uip_closed()) { connected = 0; } } else { printf("server: client not accepted!/n"); KLEENET_ASSERT(0 && "server: client not accepted!/n"); } } PROCESS_END();}
开发者ID:kincki,项目名称:contiki,代码行数:31,
示例22: socket_app_appcall/* * In socketapp.h we have defined the UIP_APPCALL macro to * socket_app_appcall so that this function is uIP's application * function. This function is called whenever an uIP event occurs * (e.g. when a new connection is established, new data arrives, sent * data is acknowledged, data needs to be retransmitted, etc.). */void socket_app_appcall(void){ /* * The uip_conn structure has a field called "appstate" that holds * the application state of the connection. We make a pointer to * this to access it easier. */ struct socket_app_state *s = &(uip_conn->appstate); /* * If a new connection was just established, we should initialize * the protosocket in our applications' state structure. */ if(uip_connected()) { //memset(s->inputbuffer, 0x00, sizeof(s->inputbuffer)); PSOCK_INIT(&s->p, (uint8_t*)s->inputbuffer, SOCKET_BUFFER_LENGTH// sizeof((uint8_t*)s->inputbuffer) ); } /* * Finally, we run the protosocket function that actually handles * the communication. We pass it a pointer to the application state * of the current connection. */ handle_connection(s);}
开发者ID:hmeyer,项目名称:RadioClock,代码行数:35,
示例23: ems_net_mainvoidems_net_main(void){ if (uip_connected()) { if (ems_conn == NULL) { ems_conn = uip_conn; uip_conn->wnd = EMS_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 (ems_conn != uip_conn) { uip_close(); } else { /* Some data we have sent was acked, jipphie */ ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { ems_recv_buffer.len -= ems_recv_buffer.sent; memmove(ems_recv_buffer.data, ems_recv_buffer.data + ems_recv_buffer.sent, ems_recv_buffer.len); } } } else if (uip_closed() || uip_aborted() || uip_timedout()) {
开发者ID:1234tester,项目名称:ethersex,代码行数:25,
示例24: PROCESS_THREADPROCESS_THREAD(tcp_process, ev, data){ static char incoming[10]; static struct psock ps; PROCESS_BEGIN(); uart0_set_br(1000000); tcp_listen(UIP_HTONS(2020)); while(1) { PROCESS_YIELD(); } { /* wait for tcp connection */ PROCESS_WAIT_EVENT_UNTIL(ev==tcpip_event && uip_connected()); /* start estimator process and init psock connection handler */ process_start(&ahrs_process, NULL); PSOCK_INIT(&ps,incoming,sizeof(incoming)); /* loop until connection is closed */ while (!(uip_aborted() || uip_closed() || uip_timedout())) { PROCESS_YIELD_UNTIL(ev==tcpip_event); handle_connection(&ps); } /* stop ahrs process */ process_exit(&ahrs_process); } PROCESS_END();}
开发者ID:cloud-hot,项目名称:Jennisense,代码行数:35,
示例25: httpd_appcall/*---------------------------------------------------------------------------*/voidhttpd_appcall(void){ struct httpd_state *s = (struct httpd_state *)&(uip_conn->appstate); if(uip_closed() || uip_aborted() || uip_timedout()) { } else if(uip_connected()) { PSOCK_INIT(&s->sin, s->inputbuf, sizeof(s->inputbuf) - 1); PSOCK_INIT(&s->sout, s->inputbuf, sizeof(s->inputbuf) - 1); PT_INIT(&s->outputpt); s->state = STATE_WAITING; /* timer_set(&s->timer, CLOCK_SECOND * 100);*/ s->timer = 0; handle_connection(s); } else if(s != NULL) { if(uip_poll()) { ++s->timer; if(s->timer >= 20) { uip_abort(); } } else { s->timer = 0; } handle_connection(s); } else { uip_abort(); }}
开发者ID:topiaruss,项目名称:xmostcptests,代码行数:29,
示例26: smtp_appcall/*DISPATCHER_UIPCALL(smtp_appcall, state)*/voidsmtp_appcall(void *state){ if(uip_connected()) { /* senddata();*/ return; } if(uip_acked()) { acked(); } if(uip_newdata()) { newdata(); } if(uip_rexmit() || uip_newdata() || uip_acked()) { senddata(); } else if(uip_poll()) { senddata(); } /* if(uip_closed()) { printf("Dnoe/n"); }*/}
开发者ID:ZhepingYang,项目名称:contiki-1.x,代码行数:27,
示例27: ctk_vncserver_appcall/*-----------------------------------------------------------------------------------*/voidctk_vncserver_appcall(void *state){ static struct vnc_server_state *vs; vs = (struct vnc_server_state *)(state); if(uip_connected()) { /* Since we've just been connected, the state pointer should be NULL and we need to allocate a new state object. If we have run out of memory for state objects, we'll have to abort the connection and return. */ if(vs == NULL) { vs = alloc_state(); if(vs == NULL) { uip_close(); return; } tcp_markconn(uip_conn, (void *)vs); } } else if(uip_closed() || uip_aborted()) { if(vs != NULL) { dealloc_state(vs); } return; } vnc_server_appcall(vs);}
开发者ID:Asterios,项目名称:contiki-econotag,代码行数:30,
示例28: httpd_appcall/*---------------------------------------------------------------------------*/voidhttpd_appcall(void *state){ struct httpd_state *s = (struct httpd_state *)state; if(uip_closed() || uip_aborted() || uip_timedout()) { if(s != NULL) { memb_free(&conns, s); } } else if(uip_connected()) { s = (struct httpd_state *)memb_alloc(&conns); if(s == NULL) { uip_abort(); return; } tcp_markconn(uip_conn, s); PSOCK_INIT(&s->sin, s->inputbuf, sizeof(s->inputbuf) - 1); PSOCK_INIT(&s->sout, s->inputbuf, sizeof(s->inputbuf) - 1); PT_INIT(&s->outputpt); s->state = STATE_WAITING; timer_set(&s->timer, CLOCK_SECOND * 10); handle_connection(s); } else if(s != NULL) { if(uip_poll()) { if(timer_expired(&s->timer)) { uip_abort(); } } else { timer_reset(&s->timer); } handle_connection(s); } else { uip_abort(); }}
开发者ID:EDAyele,项目名称:ptunes,代码行数:36,
注:本文中的uip_connected函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ uip_create_linklocal_allnodes_mcast函数代码示例 C++ uip_closed函数代码示例 |