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

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

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

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

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

示例1: dhcpdInit

static void dhcpdInit(void) {  uip_ipaddr_t remote_ipaddr;  uip_ipaddr(remote_ipaddr, 0,0,0,0);  //uip_ipaddr(remote_ipaddr, 192,168,12,2);  dhcpd_request_conn = uip_udp_new(&remote_ipaddr, HTONS(68) /* remote port */);  if(dhcpd_request_conn != NULL) {    uip_udp_bind(dhcpd_request_conn, HTONS(67) /* local port */);    printf("BIND OK");  } else {    printf("BIND ERROR!");  }  uip_ipaddr(remote_ipaddr, 255,255,255,255);  //uip_ipaddr(remote_ipaddr, 192,168,12,2);  dhcpd_reply_conn = uip_udp_new(&remote_ipaddr, HTONS(68) /* remote port */);  if(dhcpd_reply_conn != NULL) {    uip_udp_bind(dhcpd_reply_conn, HTONS(67) /* local port */);    printf("BIND OK");  } else {    printf("BIND ERROR!");  }  dhcpd_state = DHCPD_IDLE;}
开发者ID:EFraim,项目名称:trans-vpn,代码行数:25,


示例2: udp_frame_send

/** * Function to send a packet to a destination host * @param ip	ip address of packet destination host * @param port	port to use at the destination/local hosts * @param data	packet data pointer * @param len	packet data length * /return		1 if packet successfully stored, 0 if connection not possible, -1 if packet not sent yet * @note * - The packet is not sent immediately. The information is stored in an *   intermediate variable and sent in the next UDP polling event */int	udp_frame_send(uip_ipaddr_t ip, int port, char* data, int len){	int i; struct uip_udp_conn* conn;	port = htons(port);	if( len < 0 || data == NULL ) return 0;	// Check if there is an existing connection	for( i = 0; i < UIP_UDP_CONNS; i++ ) {		if( uip_udp_conns[i].rport != port ||			uip_udp_conns[i].lport != port ||			!uip_ipaddr_cmp( uip_udp_conns[i].ripaddr, ip ) ) continue;		if( udp_frame_pi[i].length > 0 ) return 0;		udp_frame_pi[i].conn = &uip_udp_conn[i];		udp_frame_pi[i].data = data;		udp_frame_pi[i].length = len;		udp_frame_pi[i].age = 0;		return 1;	}	// Create new connection	conn = uip_udp_new( (uip_ipaddr_t*) ip, port );	if( conn == NULL ) {		int oldest = 0;		// remove oldest connection to create a new one		for( i = 1; i < UIP_UDP_CONNS; i++ ) {			if( udp_frame_pi[i].age > udp_frame_pi[oldest].age ) oldest = i;		}		uip_udp_remove( udp_frame_pi[oldest].conn );		conn = uip_udp_new( (uip_ipaddr_t*) ip, port );		if( conn == NULL ) return 0;	}	// Update connection ages and data	uip_udp_bind( conn, port );	for( i = 0; i < UIP_UDP_CONNS; i++ ) {		if( &uip_udp_conns[i] == conn ) {			udp_frame_pi[i].conn = conn;			udp_frame_pi[i].data = data;			udp_frame_pi[i].length = len;			udp_frame_pi[i].age = 0;		}else{			if( udp_frame_pi[i].conn != NULL &&  udp_frame_pi[i].age < AGE_MAX )				udp_frame_pi[i].age++;	// Update age of connections		}	}	// Store packet information to be sent	return 1;}
开发者ID:GaizkaBellido,项目名称:origin_stellaris,代码行数:60,


示例3: xtcpd_connect

void xtcpd_connect(int linknum, int port_number, xtcp_ipaddr_t addr,                   xtcp_protocol_t p) {    uip_ipaddr_t uipaddr;    uip_ipaddr(uipaddr, addr[0], addr[1], addr[2], addr[3]);    if (p == XTCP_PROTOCOL_TCP) {        struct uip_conn *conn = uip_connect(&uipaddr, HTONS(port_number));        if (conn != NULL) {            xtcpd_state_t *s = (xtcpd_state_t *) &(conn->appstate);            s->linknum = linknum;            s->s.connect_request = 1;            s->conn.connection_type = XTCP_CLIENT_CONNECTION;        }    }    else {        struct uip_udp_conn *conn;        conn = uip_udp_new(&uipaddr, HTONS(port_number));        if (conn != NULL) {            xtcpd_state_t *s = (xtcpd_state_t *) &(conn->appstate);            s->linknum = linknum;            s->s.connect_request = 1;            s->conn.connection_type = XTCP_CLIENT_CONNECTION;        }    }    return;}
开发者ID:aritec,项目名称:sc_xtcp,代码行数:25,


示例4: OSC_SERVER_Init

/////////////////////////////////////////////////////////////////////////////// Initialize the OSC daemon/////////////////////////////////////////////////////////////////////////////s32 OSC_SERVER_Init(u32 mode){  // disable send packet  osc_send_packet = NULL;  // remove open connection  if(osc_conn != NULL) {    uip_udp_remove(osc_conn);  }  // create new connection  uip_ipaddr_t ripaddr;  uip_ipaddr(ripaddr,	     ((OSC_REMOTE_IP)>>24) & 0xff,	     ((OSC_REMOTE_IP)>>16) & 0xff,	     ((OSC_REMOTE_IP)>> 8) & 0xff,	     ((OSC_REMOTE_IP)>> 0) & 0xff);  if( (osc_conn=uip_udp_new(&ripaddr, HTONS(OSC_SERVER_PORT))) != NULL ) {    uip_udp_bind(osc_conn, HTONS(OSC_SERVER_PORT));#if DEBUG_VERBOSE_LEVEL >= 1    MIOS32_MIDI_SendDebugMessage("[OSC_SERVER] listen to %d.%d.%d.%d:%d/n", 				 (osc_conn->ripaddr[0] >> 0) & 0xff,				 (osc_conn->ripaddr[0] >> 8) & 0xff,				 (osc_conn->ripaddr[1] >> 0) & 0xff,				 (osc_conn->ripaddr[1] >> 8) & 0xff,				 HTONS(osc_conn->rport));#endif  } else {
开发者ID:glocklueng,项目名称:MIOS32,代码行数:32,


示例5: dhcp_net_init

void dhcp_net_init(void) {#ifdef S0BRIDGE_SUPPORT  uint8_t ips = 0;  eeprom_restore_int( ip_static, &ips );  if (ips) {    dhcp_set_static();    return;  }#endif   uip_ipaddr_t ip;  uip_ipaddr_copy(&ip, all_ones_addr);    uip_udp_conn_t *dhcp_conn = uip_udp_new(&ip, HTONS(DHCPC_SERVER_PORT), dhcp_net_main);    if(! dhcp_conn)    return; /* dammit. */    uip_udp_bind(dhcp_conn, HTONS(DHCPC_CLIENT_PORT));    dhcp_conn->appstate.dhcp.retry_counter = 0;  dhcp_conn->appstate.dhcp.retry_timer = 5;  dhcp_conn->appstate.dhcp.state = STATE_INITIAL;  tick_sec = 0;}
开发者ID:EtherGraf,项目名称:ethersex,代码行数:27,


示例6: ntp_conf

voidntp_conf(uip_ipaddr_t *ntpserver){  if (ntp_conn != NULL)    uip_udp_remove(ntp_conn);  ntp_conn = uip_udp_new(ntpserver, HTONS(NTP_PORT), ntp_newdata);}
开发者ID:1234tester,项目名称:ethersex,代码行数:7,


示例7: dhcpc_renew

voiddhcpc_renew(void){  uip_ipaddr_t addr;#if defined PORT_APP_MAPPER  if (dhcpc_running)    return;  dhcpc_running = 1;#else  if (s.state != STATE_CONFIG_RECEIVED)  {    return;  }#endif//sendString("/r/ndhcpc renew called");  // if no server ip then we have to do a full request  if (s.serverid[0] == 0)  {    dhcpc_init(s.mac_addr, s.mac_len);    return;  }  // unicast to dhcp server  uip_ipaddr(addr, s.serverid[0], s.serverid[1], s.serverid[2], s.serverid[3]);  s.conn = uip_udp_new(&addr, HTONS(DHCPC_SERVER_PORT));  if(s.conn != NULL) {    uip_udp_bind(s.conn, HTONS(DHCPC_CLIENT_PORT));  }  s.state = STATE_RENEW;  PT_INIT(&s.pt);}
开发者ID:hokim72,项目名称:AVR-Common,代码行数:35,


示例8: xtcpd_connect

/* ----------------------------------------------------------------------------- * * -------------------------------------------------------------------------- */void xtcpd_connect(int linknum, int port_number, xtcp_ipaddr_t addr,                   xtcp_protocol_t p) {  uip_ipaddr_t uipaddr;#if UIP_CONF_IPV4  uip_ipaddr(&uipaddr, addr.u8[0], addr.u8[1], addr.u8[2], addr.u8[3]);#elif UIP_CONF_IPV6  uip_ip6addr(&uipaddr, addr.u16[0], addr.u16[1], addr.u16[2], addr.u16[3],		                addr.u16[4], addr.u16[5], addr.u16[6], addr.u16[7]);#endif /* UIP_CONF_IPVx */  if (p == XTCP_PROTOCOL_TCP) {    struct uip_conn *conn = uip_connect(&uipaddr, HTONS(port_number));    if (conn != NULL) {         xtcpd_state_t *s = (xtcpd_state_t *) &(conn->appstate);         s->linknum = linknum;         s->s.connect_request = 1;         s->conn.connection_type = XTCP_CLIENT_CONNECTION;       }  }  else {    struct uip_udp_conn *conn;    conn = uip_udp_new(&uipaddr, HTONS(port_number));    if (conn != NULL) {      xtcpd_state_t *s = (xtcpd_state_t *) &(conn->appstate);      s->linknum = linknum;      s->s.connect_request = 1;      s->conn.connection_type = XTCP_CLIENT_CONNECTION;    }  }  return;}
开发者ID:ajwlucas,项目名称:lib_xtcp,代码行数:33,


示例9: udpds_conf

/*---------------------------------------------------------------------------*/void udpds_conf(u16_t *to_ip, u16_t to_port, u8_t interval){  if(udpds_conn != NULL) {    uip_udp_remove(udpds_conn);  }  timer_set(&udpds_interval_timer, (CLOCK_CONF_SECOND * interval));  udpds_conn = uip_udp_new((uip_ipaddr_t *)to_ip, HTONS(to_port));}
开发者ID:jaseg,项目名称:avr-uip,代码行数:10,


示例10: my_udp8899_init

/***************************************************************************** 函 数 名  : my_udp8899_init 功能描述  : a uip udp function for local port is 8899 输入参数  : void   输出参数  : 无 返 回 值  : static 调用函数  :  被调函数  :   修改历史      :  1.日    期   : 2017年4月17日    作    者   : QSWWD    修改内容   : 新生成函数*****************************************************************************/static void my_udp8899_init(void){	uip_ipaddr_t remote_addr;	uip_ipaddr(remote_addr, 192,168,1,8);	struct uip_udp_conn *my_udp_con = uip_udp_new(&remote_addr,HTONS(8899));	if(my_udp_con != NULL)	{		uip_udp_bind(my_udp_con,HTONS(8899));	}}
开发者ID:haikong,项目名称:haikong.github.io,代码行数:25,


示例11: artnet_net_init

voidartnet_net_init(void){  uip_udp_conn_t *conn;  if(! (conn = uip_udp_new(&all_ones_addr, 0, artnet_net_main)))     return; /* Couldn't bind socket */  uip_udp_bind(conn, HTONS(artnet_port));}
开发者ID:HansBaechle,项目名称:ethersex,代码行数:10,


示例12: announce_handle_packet

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