您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ udp_remove函数代码示例

51自学网 2021-06-03 09:06:26
  C++
这篇教程C++ udp_remove函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中udp_remove函数的典型用法代码示例。如果您正苦于以下问题:C++ udp_remove函数的具体用法?C++ udp_remove怎么用?C++ udp_remove使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了udp_remove函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: netShutdown

/* Shut down  the UDP and network stuff */bool netShutdown(NetPath *netPath){	struct ip_addr multicastAaddr;	DBG("netShutdown/n");	/* leave multicast group */	multicastAaddr.addr = netPath->multicastAddr;	igmp_leavegroup(IP_ADDR_ANY, &multicastAaddr);	/* Disconnect and close the Event UDP interface */	if (netPath->eventPcb)	{		udp_disconnect(netPath->eventPcb);		udp_remove(netPath->eventPcb);		netPath->eventPcb = NULL;	}	/* Disconnect and close the General UDP interface */	if (netPath->generalPcb)	{		udp_disconnect(netPath->generalPcb);		udp_remove(netPath->generalPcb);		netPath->generalPcb = NULL;	}	/* Clear the network addresses. */	netPath->multicastAddr = 0;	netPath->unicastAddr = 0;	/* Return a success code. */	return TRUE;}
开发者ID:mpthompson,项目名称:stm32_f4_ptpd,代码行数:34,


示例2: netShutdown

/* shut down the UDP stuff */Boolean netShutdown(NetPath *netPath){    /* Disconnect and close the Event UDP interface */    if(netPath->eventPcb) {        udp_disconnect(netPath->eventPcb);        udp_remove(netPath->eventPcb);    }    /* Disconnect and close the General UDP interface */    if(netPath->generalPcb) {        udp_disconnect(netPath->generalPcb);        udp_remove(netPath->generalPcb);    }    /* Free up the Event and General Tx PBUFs. */    if(netPath->eventTxBuf) {        pbuf_free(netPath->eventTxBuf);    }    if(netPath->generalTxBuf) {        pbuf_free(netPath->generalTxBuf);    }    /* Clear the network addresses. */    netPath->multicastAddr = 0;    netPath->unicastAddr = 0;    /* Return a success code. */    return TRUE;}
开发者ID:peterliu2,项目名称:tivaWare,代码行数:30,


示例3: pxudp_pcb_accept

/** * New proxied UDP conversation created. * Global callback for udp_proxy_accept(). */static voidpxudp_pcb_accept(void *arg, struct udp_pcb *newpcb, struct pbuf *p,                 ip_addr_t *addr, u16_t port){    struct pxudp *pxudp;    ipX_addr_t dst_addr;    int mapping;    int sdom;    SOCKET sock;    LWIP_ASSERT1(newpcb != NULL);    LWIP_ASSERT1(p != NULL);    LWIP_UNUSED_ARG(arg);    pxudp = pxudp_allocate();    if (pxudp == NULL) {        DPRINTF(("pxudp_allocate: failed/n"));        udp_remove(newpcb);        pbuf_free(p);        return;    }    sdom = PCB_ISIPV6(newpcb) ? PF_INET6 : PF_INET;    mapping = pxremap_outbound_ipX(PCB_ISIPV6(newpcb), &dst_addr, &newpcb->local_ip);#if 0 /* XXX: DNS IPv6->IPv4 remapping hack */    if (mapping == PXREMAP_MAPPED        && newpcb->local_port == 53        && PCB_ISIPV6(newpcb))    {        /*         * "Remap" DNS over IPv6 to IPv4 since Ubuntu dnsmasq does not         * listen on IPv6.         */        sdom = PF_INET;        ipX_addr_set_loopback(0, &dst_addr);    }#endif  /* DNS IPv6->IPv4 remapping hack */    sock = proxy_connected_socket(sdom, SOCK_DGRAM,                                  &dst_addr, newpcb->local_port);    if (sock == INVALID_SOCKET) {        udp_remove(newpcb);        pbuf_free(p);        return;    }    pxudp->sock = sock;    pxudp->pcb = newpcb;    udp_recv(newpcb, pxudp_pcb_recv, pxudp);    pxudp->pmhdl.callback = pxudp_pmgr_pump;    pxudp_chan_send(POLLMGR_CHAN_PXUDP_ADD, pxudp);    /* dispatch directly instead of calling pxudp_pcb_recv() */    pxudp_pcb_forward_outbound(pxudp, p, addr, port);}
开发者ID:eaas-framework,项目名称:virtualbox,代码行数:61,


示例4: mdns_responder_init

err_t mdns_responder_init(const struct mdns_service *services,                          int num_services,                          const char *txt_records[]){    err_t ret;    memset(&mdns_state, 0, sizeof(mdns_state));    mdns_state.netif = &gs_net_if;    setup_hostnames(&mdns_state, &gs_net_if);    setup_txt_records(&mdns_state, txt_records);    mdns_state.services = services;    mdns_state.num_services = num_services;    struct ip_addr ipgroup;    IP4_ADDR(&ipgroup, 224, 0, 0, 251);    mdns_state.sendpcb = udp_new();    if (mdns_state.sendpcb == NULL)        return ERR_MEM;    struct udp_pcb *pcb = udp_new();    if (pcb == NULL) {        udp_remove(mdns_state.sendpcb);        return ERR_MEM;    }    if ((ret = igmp_joingroup(IP_ADDR_ANY, &ipgroup)) != ERR_OK)        return ret;    ip_set_option(pcb, SOF_REUSEADDR);    ip_set_option(mdns_state.sendpcb, SOF_REUSEADDR);    if ((ret = udp_bind(pcb, IP_ADDR_ANY, MDNS_PORT)) != ERR_OK)        goto error_exit;    udp_recv(pcb, recv, &mdns_state);    if ((ret = udp_bind(mdns_state.sendpcb, 0, MDNS_PORT)) != ERR_OK)        goto error_exit;    if ((ret = udp_connect(mdns_state.sendpcb, &ipgroup, MDNS_PORT)) != ERR_OK)        goto error_exit;    return ERR_OK;error_exit:    udp_remove(pcb);    udp_remove(mdns_state.sendpcb);    return ret;}
开发者ID:dcnewman,项目名称:RepRapFirmware-RADDS,代码行数:53,


示例5: udp_remove

void ESP8266NetBIOS::end(){    if(_pcb != NULL) {        udp_remove(_pcb);        _pcb = NULL;    }}
开发者ID:AndresCotes,项目名称:Arduino,代码行数:7,


示例6: udp_test_port_init

/****************************************************************************** * FunctionName : udp_test_port_init * Returns      : none*******************************************************************************/void ICACHE_FLASH_ATTR udp_test_port_init(uint16 portn){	  struct udp_pcb *pcb;#if DEBUGSOO > 0	   os_printf("/nUDP Test port %d init... ", portn);#endif	   pcb = udp_new();	   if(pcb != NULL) {		   err_t err = udp_bind(pcb, IP_ADDR_ANY, portn);		   if(err != ERR_OK) {#if DEBUGSOO > 0			   os_printf("Error bind/n");#endif			   udp_remove(pcb);			   return;		   };		   udp_recv(pcb, udp_test_port_recv, pcb);	   }	   else {#if DEBUGSOO > 0	   os_printf("Error mem/n");#endif	   }#if DEBUGSOO > 0	   os_printf("Ok/n");#endif}
开发者ID:georgkreimer,项目名称:esp8266web,代码行数:31,


示例7: udp_echoserver_init

/**  * @brief  Initialize the server application.  * @param  None  * @retval None  */void udp_echoserver_init(void){   struct udp_pcb *upcb;   err_t err;      /* Create a new UDP control block  */   upcb = udp_new();      if (upcb)   {     /* Bind the upcb to the UDP_PORT port */     /* Using IP_ADDR_ANY allow the upcb to be used by any local interface */      err = udp_bind(upcb, IP_ADDR_ANY, UDP_SERVER_PORT);            if(err == ERR_OK)      {        /* Set a receive callback for the upcb */        udp_recv(upcb, udp_echoserver_receive_callback, NULL);      }      else      {        udp_remove(upcb);      }   }}
开发者ID:451506709,项目名称:automated_machine,代码行数:30,


示例8: init_transport

intinit_transport(struct ip_addr server){    struct pbuf *pbuf;    udp_cnx = udp_new();    udp_recv(udp_cnx, time_recv, (void*) L4_Myself().raw);    udp_bind(udp_cnx, IP_ADDR_ANY, NFS_LOCAL_PORT);    udp_connect(udp_cnx, &server, 37 /* Time port */);    do {	pbuf = pbuf_alloc(PBUF_TRANSPORT, UDP_PAYLOAD, PBUF_RAM);	udp_send(udp_cnx, pbuf);	sos_usleep(100);	pbuf_free(pbuf);    } while (time_of_day == 0);    udp_remove(udp_cnx);    cur_xid = time_of_day * 10000; /* Generate a randomish xid */    udp_cnx = udp_new();    udp_recv(udp_cnx, my_recv, NULL);    udp_connect(udp_cnx, &server, 0);    udp_bind(udp_cnx, IP_ADDR_ANY, NFS_LOCAL_PORT);    return 0;}
开发者ID:gz,项目名称:aos10,代码行数:28,


示例9: mg_if_destroy_conn

void mg_if_destroy_conn(struct mg_connection *nc) {  int i;  if (nc->sock != INVALID_SOCKET) {    struct mg_lwip_conn_state *cs = (struct mg_lwip_conn_state *) nc->sock;    if (!(nc->flags & MG_F_UDP)) {      struct tcp_pcb *tpcb = cs->pcb.tcp;      if (tpcb != NULL) {        tcp_arg(tpcb, NULL);        DBG(("%p tcp_close %p", nc, tpcb));        tcp_arg(tpcb, NULL);        tcp_close(tpcb);      }      while (cs->rx_chain != NULL) {        struct pbuf *seg = cs->rx_chain;        cs->rx_chain = pbuf_dechain(cs->rx_chain);        pbuf_free(seg);      }    } else {      struct udp_pcb *upcb = cs->pcb.udp;      if (upcb != NULL) {        DBG(("%p udp_remove %p", nc, upcb));        udp_remove(upcb);      }    }    memset(cs, 0, sizeof(*cs));    free(cs);    nc->sock = INVALID_SOCKET;  }  /* Walk the queue and null-out further signals for this conn. */  for (i = 0; i < MG_TASK_QUEUE_LEN; i++) {    if ((struct mg_connection *) s_mg_task_queue[i].par == nc) {      s_mg_task_queue[i].sig = MG_SIG_TOMBSTONE;    }  }}
开发者ID:MrZANE42,项目名称:smart.js,代码行数:35,


示例10: net_close

// Lua: client/server/socket:close()int net_close( lua_State *L ) {  lnet_userdata *ud = net_get_udata(L);  if (!ud) return luaL_error(L, "invalid user data");  if (ud->pcb) {    switch (ud->type) {      case TYPE_TCP_CLIENT:        if (ERR_OK != tcp_close(ud->tcp_pcb)) {          tcp_arg(ud->tcp_pcb, NULL);          tcp_abort(ud->tcp_pcb);        }        ud->tcp_pcb = NULL;        break;      case TYPE_TCP_SERVER:        tcp_close(ud->tcp_pcb);        ud->tcp_pcb = NULL;        break;      case TYPE_UDP_SOCKET:        udp_remove(ud->udp_pcb);        ud->udp_pcb = NULL;        break;    }  } else {    return luaL_error(L, "not connected");  }  if (ud->type == TYPE_TCP_SERVER ||     (ud->pcb == NULL && ud->client.wait_dns == 0)) {    lua_gc(L, LUA_GCSTOP, 0);    luaL_unref(L, LUA_REGISTRYINDEX, ud->self_ref);    ud->self_ref = LUA_NOREF;    lua_gc(L, LUA_GCRESTART, 0);  }  return 0;}
开发者ID:Dxploto,项目名称:nodemcu-firmware,代码行数:34,


示例11: ard_tcp_destroy

/** * Clean up and free the ttcp structure */static void ard_tcp_destroy(struct ttcp* ttcp) {	err_t err = ERR_OK;	DUMP_TCP_STATE(ttcp);	if (getSock(ttcp)==-1)		WARN("ttcp already deallocated!/n");	if (ttcp->tpcb) {		tcp_arg(ttcp->tpcb, NULL);		tcp_sent(ttcp->tpcb, NULL);		tcp_recv(ttcp->tpcb, NULL);		tcp_err(ttcp->tpcb, NULL);		//TEMPORAQARY		//err = tcp_close(ttcp->tpcb);		INFO_TCP("Closing tpcb: state:0x%x err:%d/n", ttcp->tpcb->state, err);	}	if (ttcp->lpcb) {		tcp_arg(ttcp->lpcb, NULL);		tcp_accept(ttcp->lpcb, NULL);		err = tcp_close(ttcp->lpcb);		INFO_TCP("Closing lpcb: state:0x%x err:%d/n", ttcp->lpcb->state, err);	}	if (ttcp->upcb) {		udp_disconnect(ttcp->upcb);		udp_remove(ttcp->upcb);	}	if (ttcp->payload)		free(ttcp->payload);	free(ttcp);}
开发者ID:4bcat,项目名称:Arduino,代码行数:37,


示例12: simple_discovery_init

err_t simple_discovery_init(struct netif *netif){    err_t ret;    struct udp_pcb *pcb = udp_new();    if (pcb == NULL)        return ERR_MEM;#if LWIP_IGMP    struct ip_addr ipgroup;    IP4_ADDR(&ipgroup, 224, 0, 0, 178);    if ((ret = igmp_joingroup(IP_ADDR_ANY, &ipgroup)) != ERR_OK)        goto error_exit;#endif    if ((ret = udp_bind(pcb, IP_ADDR_ANY, SIMPLE_DISCOVERY_PORT)) != ERR_OK)        goto error_exit;    udp_recv(pcb, recv, netif);    return ERR_OK;error_exit:    udp_remove(pcb);    return ret;}
开发者ID:EmuxEvans,项目名称:lwip_contrib,代码行数:27,


示例13: tftp_cleanup

/** @ingroup tftp * Deinitialize ("turn off") TFTP client/server. */void tftp_cleanup(void){  LWIP_ASSERT("Cleanup called on non-initialized TFTP", tftp_state.upcb != NULL);  udp_remove(tftp_state.upcb);  close_handle();  memset(&tftp_state, 0, sizeof(tftp_state));}
开发者ID:olsner,项目名称:lwip,代码行数:10,


示例14: tftp_init_common

/** * Initialize TFTP client/server. * @param mode TFTP mode (client/server) * @param ctx TFTP callback struct */err_ttftp_init_common(u8_t mode, const struct tftp_context *ctx){  err_t ret;  /* LWIP_ASSERT_CORE_LOCKED(); is checked by udp_new() */  struct udp_pcb *pcb = udp_new_ip_type(IPADDR_TYPE_ANY);  if (pcb == NULL) {    return ERR_MEM;  }  ret = udp_bind(pcb, IP_ANY_TYPE, TFTP_PORT);  if (ret != ERR_OK) {    udp_remove(pcb);    return ret;  }  tftp_state.handle    = NULL;  tftp_state.port      = 0;  tftp_state.ctx       = ctx;  tftp_state.timer     = 0;  tftp_state.last_data = NULL;  tftp_state.upcb      = pcb;  tftp_state.tftp_mode = mode;  udp_recv(pcb, recv, NULL);  return ERR_OK;}
开发者ID:olsner,项目名称:lwip,代码行数:34,


示例15: tftp_init

err_t tftp_init(const struct tftp_context *ctx){    err_t ret;    struct udp_pcb *pcb = udp_new();    if (pcb == NULL)        return ERR_MEM;    if ((ret = udp_bind(pcb, IP_ADDR_ANY, TFTP_PORT)) != ERR_OK)        goto error_exit;    tftp_state.handle = NULL;    tftp_state.port = 0;    tftp_state.ctx = ctx;    tftp_state.timer = 0;    tftp_state.last_data = NULL;    udp_recv(pcb, recv, &tftp_state);    return ERR_OK;error_exit:    udp_remove(pcb);    return ret;}
开发者ID:EmuxEvans,项目名称:lwip_contrib,代码行数:26,


示例16: ard_tcp_abort

/** * Clean up and free the ttcp structure */static void ard_tcp_abort(struct ttcp* ttcp) {	INFO_TCP("Abort ttcb:%p tpcb:%p lpcb:%p/n", ttcp, ttcp->tpcb, ttcp->lpcb);	if (ttcp->tpcb) {		tcp_arg(ttcp->tpcb, NULL);		tcp_sent(ttcp->tpcb, NULL);		tcp_recv(ttcp->tpcb, NULL);		tcp_err(ttcp->tpcb, NULL);		tcp_abort(ttcp->tpcb);	}	if (ttcp->lpcb) {		tcp_arg(ttcp->lpcb, NULL);		tcp_accept(ttcp->lpcb, NULL);		tcp_abort(ttcp->lpcb);	}	if (ttcp->upcb) {		udp_disconnect(ttcp->upcb);		udp_remove(ttcp->upcb);	}	if (ttcp->payload)		free(ttcp->payload);	free(ttcp);}
开发者ID:4bcat,项目名称:Arduino,代码行数:30,


示例17: tftp_init

/** @ingroup tftp * Initialize TFTP server. * @param ctx TFTP callback struct */err_t tftp_init(const struct tftp_context *ctx){  err_t ret;  struct udp_pcb *pcb = udp_new_ip_type(IPADDR_TYPE_ANY);  if (pcb == NULL) {    return ERR_MEM;  }  ret = udp_bind(pcb, IP_ANY_TYPE, TFTP_PORT);  if (ret != ERR_OK) {    udp_remove(pcb);    return ret;  }  tftp_state.handle    = NULL;  tftp_state.port      = 0;  tftp_state.ctx       = ctx;  tftp_state.timer     = 0;  tftp_state.last_data = NULL;  tftp_state.upcb      = pcb;  udp_recv(pcb, recv, NULL);  return ERR_OK;}
开发者ID:Archcady,项目名称:mbed-os,代码行数:31,


示例18: lwip_socket_close

STATIC mp_obj_t lwip_socket_close(mp_obj_t self_in) {    lwip_socket_obj_t *socket = self_in;    bool socket_is_listener = false;    if (socket->pcb.tcp == NULL) {        return mp_const_none;    }    switch (socket->type) {        case MOD_NETWORK_SOCK_STREAM: {            if (socket->pcb.tcp->state == LISTEN) {                socket_is_listener = true;            }            if (tcp_close(socket->pcb.tcp) != ERR_OK) {                tcp_abort(socket->pcb.tcp);            }            break;        }        case MOD_NETWORK_SOCK_DGRAM: udp_remove(socket->pcb.udp); break;        //case MOD_NETWORK_SOCK_RAW: raw_remove(socket->pcb.raw); break;    }    socket->pcb.tcp = NULL;    socket->state = _ERR_BADF;    if (socket->incoming.pbuf != NULL) {        if (!socket_is_listener) {            pbuf_free(socket->incoming.pbuf);        } else {            tcp_abort(socket->incoming.connection);        }        socket->incoming.pbuf = NULL;    }    return mp_const_none;}
开发者ID:TDAbboud,项目名称:micropython,代码行数:33,


示例19: udp_echo_server_init

int udp_echo_server_init(void){    int r;    uint16_t bind_port = 7; //don't use htons() (don't know why...)    //create a new UDP PCB    struct udp_pcb *pcb = udp_new(); //UDP connection data    if (pcb == NULL) {        return ERR_MEM;    }    //bind it to every IP of every interface and define a specific port to    //bind to    r = udp_bind(pcb, IP_ADDR_ANY, bind_port);    if(r != ERR_OK) {        udp_remove(pcb);        return(r);    }    printf("udp_echo_server_init(): bound./n");    //install a callback for received datagrams    udp_recv(pcb, echo_recv_handler, 0 /*client data, arg in callback*/);    printf("installed receive callback./n");    struct pbuf * test_pbuf = pbuf_alloc(PBUF_RAW, 256, PBUF_RAM);    memcpy(test_pbuf->payload, "DDDDDDDDDUUUUUUUUU", 16);    netif_default->linkoutput(netif_default, test_pbuf);    return (0);}
开发者ID:Karamax,项目名称:arrakis,代码行数:33,


示例20: ttcp_destroy

/** * Clean up and free the ttcp structure */static voidttcp_destroy(struct ttcp* ttcp){        if (ttcp->tpcb) {                tcp_arg(ttcp->tpcb, NULL);                tcp_sent(ttcp->tpcb, NULL);                tcp_recv(ttcp->tpcb, NULL);                tcp_err(ttcp->tpcb, NULL);                tcp_close(ttcp->tpcb);        }        if (ttcp->lpcb) {                tcp_arg(ttcp->lpcb, NULL);                tcp_accept(ttcp->lpcb, NULL);                tcp_close(ttcp->lpcb);        }        if (ttcp->upcb) {                udp_disconnect(ttcp->upcb);                udp_remove(ttcp->upcb);        }        if (ttcp->payload)                free(ttcp->payload);        timer_cancel_timeout(ttcp->tid);        free(ttcp);}
开发者ID:ThucVD2704,项目名称:femto-usb-blink-example,代码行数:30,


示例21: dhcps_start

void ICACHE_FLASH_ATTR dhcps_start(struct ip_info *info){	struct netif * apnetif = (struct netif *)eagle_lwip_getif(0x01);	if(apnetif->dhcps_pcb != NULL) {        udp_remove(apnetif->dhcps_pcb);    }	pcb_dhcps = udp_new();	if (pcb_dhcps == NULL || info ==NULL) {		os_printf("dhcps_start(): could not obtain pcb/n");	}	apnetif->dhcps_pcb = pcb_dhcps;	IP4_ADDR(&broadcast_dhcps, 255, 255, 255, 255);	server_address = info->ip;	wifi_softap_init_dhcps_lease(server_address.addr);	client_address_plus.addr = dhcps_lease.start_ip.addr;	udp_bind(pcb_dhcps, IP_ADDR_ANY, DHCPS_SERVER_PORT);	udp_recv(pcb_dhcps, handle_dhcp, NULL);#if DHCPS_DEBUG	os_printf("dhcps:dhcps_start->udp_recv function Set a receive callback handle_dhcp for UDP_PCB pcb_dhcps/n");#endif}
开发者ID:marktsai0316,项目名称:esp8266web,代码行数:27,


示例22: lwip_socket_close

STATIC mp_obj_t lwip_socket_close(mp_obj_t self_in) {    lwip_socket_obj_t *socket = self_in;    bool socket_is_listener = false;    if (socket->pcb == NULL) {        return mp_const_none;    }    switch (socket->type) {        case MOD_NETWORK_SOCK_STREAM: {            if (((struct tcp_pcb*)socket->pcb)->state == LISTEN) {                socket_is_listener = true;            }            if (tcp_close((struct tcp_pcb*)socket->pcb) != ERR_OK) {                tcp_abort((struct tcp_pcb*)socket->pcb);            }            break;        }        case MOD_NETWORK_SOCK_DGRAM: udp_remove((struct udp_pcb*)socket->pcb); break;        //case MOD_NETWORK_SOCK_RAW: raw_remove((struct raw_pcb*)socket->pcb); break;    }    socket->pcb = NULL;    socket->connected = -16; // EBADF    if (socket->incoming != NULL) {        if (!socket_is_listener) {            pbuf_free((struct pbuf*)socket->incoming);        } else {            tcp_abort((struct tcp_pcb*)socket->incoming);        }        socket->incoming = NULL;    }    return mp_const_none;}
开发者ID:opensourcekids,项目名称:micropython,代码行数:33,


示例23: dhcps_stop

void ICACHE_FLASH_ATTR dhcps_stop(void){	struct netif * apnetif = (struct netif *)eagle_lwip_getif(0x01);	udp_disconnect(pcb_dhcps);	dhcps_lease_flag = true;    if(apnetif->dhcps_pcb != NULL) {        udp_remove(apnetif->dhcps_pcb);        apnetif->dhcps_pcb = NULL;    }	//udp_remove(pcb_dhcps);	list_node *pnode = NULL;	list_node *pback_node = NULL;	pnode = plist;	while (pnode != NULL) {		pback_node = pnode;		pnode = pback_node->pnext;		node_remove_from_list(&plist, pback_node);		os_free(pback_node->pnode);		pback_node->pnode = NULL;		os_free(pback_node);		pback_node = NULL;	}}
开发者ID:marktsai0316,项目名称:esp8266web,代码行数:25,


示例24: espconn_udp_server

/****************************************************************************** * FunctionName : espconn_udp_server * Description  : Initialize the server: set up a PCB and bind it to the port * Parameters   : pespconn -- the espconn used to build server * Returns      : none*******************************************************************************/sint8 ICACHE_FLASH_ATTRespconn_udp_server(struct espconn *pespconn){    struct udp_pcb *upcb = NULL;    espconn_msg *pserver = NULL;    upcb = udp_new();    if (upcb == NULL) {        return ESPCONN_MEM;    } else {        pserver = (espconn_msg *)os_zalloc(sizeof(espconn_msg));        if (pserver == NULL) {            udp_remove(upcb);            return ESPCONN_MEM;        }        pserver->pcommon.pcb = upcb;        pserver->pespconn = pespconn;        espconn_list_creat(&plink_active, pserver);        udp_bind(upcb, IP_ADDR_ANY, pserver->pespconn->proto.udp->local_port);        udp_recv(upcb, espconn_udp_recv, (void *)pserver);        return ESPCONN_OK;    }}
开发者ID:4m1g0,项目名称:Arduino,代码行数:31,


示例25: port_create

/**@brief Creates port as requested in p_port. * * @details Creates port as requested in p_port. * * @param[in]   index    Index to the m_port_table where entry of the port created is to be made. * @param[in]   p_port   Port information to be created. * * @retval NRF_SUCCESS   Indicates if port was created successfully, else an an  error code *                       indicating reason for failure. */static uint32_t port_create(uint32_t index, coap_port_t  * p_port){    err_t           err = NRF_ERROR_NO_MEM;    ip6_addr_t      any_addr;    struct udp_pcb * p_socket = m_port_table[index].p_socket;    ip6_addr_set_any(&any_addr);    //Request new socket creation.    p_socket = udp_new();    if (NULL != p_socket)    {        // Bind the socket to the local port.        err = udp_bind(p_socket, &any_addr, p_port->port_number);        if (err == ERR_OK)        {            //Register data receive callback.            udp_recv(p_socket, udp_recv_data_handler, &m_port_table[index]);            //All procedure with respect to port creation succeeded, make entry in the table.            m_port_table[index].port_number = p_port->port_number;            m_port_table[index].p_socket    = p_socket;        }        else        {            //Not all procedures succeeded with allocated socket, hence free it.            err = NRF_ERROR_INVALID_PARAM;            udp_remove(p_socket);        }    }    return err;}
开发者ID:kiibohd,项目名称:controller,代码行数:43,


示例26: net_create_udp_connection

/*  * FIXME: currently we associate a connection with a thread (and an * upcall thread), which is restrictive. */net_connection_t net_create_udp_connection(spdid_t spdid, long evt_id){	struct udp_pcb *up;	struct intern_connection *ic;	net_connection_t ret;	up = udp_new();		if (NULL == up) {		prints("Could not allocate udp connection");		ret = -ENOMEM;		goto err;	}	ic = net_conn_alloc(UDP, cos_get_thd_id(), evt_id);	if (NULL == ic) {		prints("Could not allocate internal connection");		ret = -ENOMEM;		goto udp_err;	}	ic->spdid = spdid;	ic->conn.up = up;	udp_recv(up, cos_net_lwip_udp_recv, (void*)ic);	return net_conn_get_opaque(ic);udp_err:	udp_remove(up);err:	return ret;}
开发者ID:songjiguo,项目名称:C3,代码行数:31,


示例27: udpd_Send

/* * 函数名:updd_Send * 描述  :发送udp数据包 * 输入  :无 * 输出  : 无 * 调用  :外部调用 */void udpd_Send(void){	struct udp_pcb *UdpPcb;   struct ip_addr ipaddr;   struct pbuf *p;	err_t err = ERR_Mine;	//测试用		p = pbuf_alloc(PBUF_RAW,sizeof(UDPData),PBUF_RAM);   p->payload=(void *)UDPData;    	UdpPcb = udp_new(); 	udp_bind(UdpPcb,IP_ADDR_ANY,6000);       /* 绑定本地IP 地址 */   IP4_ADDR(&ipaddr,192,168,1,122);     err = udp_connect(UdpPcb,&ipaddr,6001);   /* 连接远程主机 */ 		if(err == ERR_OK)	{		err = ERR_Mine;	//测试用		err = udp_send(UdpPcb, p);	}		udp_disconnect(UdpPcb);	pbuf_free(p);	udp_remove(UdpPcb);}
开发者ID:Micah2015,项目名称:STM32_LwIP,代码行数:33,


示例28: lwip_netconn_do_delconn

/** * Delete the pcb inside a netconn. * Called from netconn_delete. * * @param msg the api_msg_msg pointing to the connection */voidlwip_netconn_do_delconn(struct api_msg_msg *msg){  /* @todo TCP: abort running write/connect? */ if ((msg->conn->state != NETCONN_NONE) &&     (msg->conn->state != NETCONN_LISTEN) &&     (msg->conn->state != NETCONN_CONNECT)) {    /* this only happens for TCP netconns */    LWIP_ASSERT("NETCONNTYPE_GROUP(msg->conn->type) == NETCONN_TCP",                NETCONNTYPE_GROUP(msg->conn->type) == NETCONN_TCP);    msg->err = ERR_INPROGRESS;  } else {    LWIP_ASSERT("blocking connect in progress",      (msg->conn->state != NETCONN_CONNECT) || IN_NONBLOCKING_CONNECT(msg->conn));    /* Drain and delete mboxes */    netconn_drain(msg->conn);    if (msg->conn->pcb.tcp != NULL) {      switch (NETCONNTYPE_GROUP(msg->conn->type)) {#if LWIP_RAW      case NETCONN_RAW:        raw_remove(msg->conn->pcb.raw);        break;#endif /* LWIP_RAW */#if LWIP_UDP      case NETCONN_UDP:        msg->conn->pcb.udp->recv_arg = NULL;        udp_remove(msg->conn->pcb.udp);        break;#endif /* LWIP_UDP */#if LWIP_TCP      case NETCONN_TCP:        LWIP_ASSERT("already writing or closing", msg->conn->current_msg == NULL &&          msg->conn->write_offset == 0);        msg->conn->state = NETCONN_CLOSE;        msg->msg.sd.shut = NETCONN_SHUT_RDWR;        msg->conn->current_msg = msg;        lwip_netconn_do_close_internal(msg->conn);        /* API_EVENT is called inside lwip_netconn_do_close_internal, before releasing           the application thread, so we can return at this point! */        return;#endif /* LWIP_TCP */      default:        break;      }      msg->conn->pcb.tcp = NULL;    }    /* tcp netconns don't come here! */    /* @todo: this lets select make the socket readable and writable,       which is wrong! errfd instead? */    API_EVENT(msg->conn, NETCONN_EVT_RCVPLUS, 0);    API_EVENT(msg->conn, NETCONN_EVT_SENDPLUS, 0);  }  if (sys_sem_valid(&msg->conn->op_completed)) {    sys_sem_signal(&msg->conn->op_completed);  }}
开发者ID:mtharp,项目名称:lwip,代码行数:65,


示例29: sntp_stop

/** * Stop this module. */voidsntp_stop(void){  if (sntp_pcb != NULL) {    sys_untimeout(sntp_request, NULL);    udp_remove(sntp_pcb);    sntp_pcb = NULL;  }}
开发者ID:cernekee,项目名称:ocproxy,代码行数:12,


示例30: udp_close_cb

static void udp_close_cb(void *ctx_p){    struct socket_t *socket_p = ctx_p;    udp_recv(socket_p->pcb_p, NULL, NULL);    udp_remove(socket_p->pcb_p);    resume_thrd(socket_p->input.cb.thrd_p, 0);}
开发者ID:eerimoq,项目名称:simba,代码行数:9,



注:本文中的udp_remove函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ udp_send函数代码示例
C++ udp_recv函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。