这篇教程C++ uip_listen函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中uip_listen函数的典型用法代码示例。如果您正苦于以下问题:C++ uip_listen函数的具体用法?C++ uip_listen怎么用?C++ uip_listen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了uip_listen函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: listen_initvoid listen_init(void){ //80端口用于web页面 uip_listen(HTONS(8079)); //用于串口波特率设置 uip_listen(HTONS(8080)); //用于收发数据 uip_listen(HTONS(80)); /* http server */}
开发者ID:crazyhuaer,项目名称:geeknimo,代码行数:7,
示例2: listen/** * /brief Start listening to the specified port. Standard BSD listen() with internal name. * /param[in] desc socket descriptor to start listening on. * /param[in] maxcon is be the maximum TCP connections to accept on that socket. Unsued parameter with current implementation. * /details To accept connections, a socket is first created with socket(), a willingness to accept incoming connections is specified with listen(), and then the connections are accepted with accept(). The listen() call applies only to sockets of type /ref SOCK_STREAM (TCP). * /note Default maximum number of connections unknown? * /return On connection success, zero is returned. On error, -1 is returned. * /callgraph */int _sys_sock_listen(int fd,int maxcon){#if defined (__KERNEL_NET_IPSTACK) && defined (USE_UIP_CORE) pid_t pid; kernel_pthread_t* pthread_ptr; hsock_t hsock = 0; desc_t desc; // // if(!(pthread_ptr = kernel_pthread_self())){ __set_kernel_pthread_errno(ESRCH); return -1; } if((pid=pthread_ptr->pid)<=0){ __set_kernel_pthread_errno(ESRCH); return -1; } // if(fd<0){ __set_kernel_pthread_errno (EBADF); return -1; } // desc = process_lst[pid]->desc_tbl[fd]; if(desc<0){ __set_kernel_pthread_errno (EBADF); return -1; } if(!ofile_lst[desc].used){ __set_kernel_pthread_errno (EBADF); return -1; } if(! (hsock = ofile_lst[desc].p) ){ __set_kernel_pthread_errno (ENOTSOCK); return -1; } if(((socket_t*)hsock)->protocol!=IPPROTO_TCP){ __set_kernel_pthread_errno (EPROTONOSUPPORT); return -1; } //lock __lock_io(ofile_lst[desc].owner_pthread_ptr_write,desc,O_WRONLY); __lock_io(ofile_lst[desc].owner_pthread_ptr_read,desc,O_RDONLY); // ((socket_t*)hsock)->state = STATE_SOCKET_LISTEN; #if UIP_CONF_IPV6 uip_listen( (u16_t)( ((socket_t*)hsock)->addr_in.sin6_port) ); #else uip_listen( (u16_t)( ((socket_t*)hsock)->addr_in.sin_port) ); #endif //unlock __unlock_io(ofile_lst[desc].owner_pthread_ptr_write,desc,O_WRONLY); __unlock_io(ofile_lst[desc].owner_pthread_ptr_read,desc,O_RDONLY); // __set_kernel_pthread_errno (0); // return 0;#else return -1;#endif} //end of _sys_sock_listen()
开发者ID:lepton-distribution,项目名称:lepton-root.scions,代码行数:71,
示例3: network_initvoidnetwork_init(void){ uip_listen(HTONS(NETWORK_PORT_GCODE)); uip_listen(HTONS(NETWORK_PORT_DEBUG)); // Listen on a UDP port uip_ipaddr_t addr; struct uip_udp_conn *c; uip_ipaddr(&addr, 0,0,0,0); c = uip_udp_new(&addr, HTONS(0)); if(c != NULL) uip_udp_bind(c, HTONS(NETWORK_PORT_GCODE));}
开发者ID:jsr38,项目名称:makebed,代码行数:14,
示例4: elua_accept// Accept a connection on the given port, return its socket id (and the IP of the remote host by side effect)int elua_accept( u16 port, unsigned timer_id, u32 to_us, elua_net_ip* pfrom ){ u32 tmrstart = 0; int old_status; if( !elua_uip_configured ) return -1;#ifdef BUILD_CON_TCP if( port == ELUA_NET_TELNET_PORT ) return -1;#endif old_status = platform_cpu_set_global_interrupts( PLATFORM_CPU_DISABLE ); uip_unlisten( htons( port ) ); uip_listen( htons( port ) ); platform_cpu_set_global_interrupts( old_status ); elua_uip_accept_sock = -1; elua_uip_accept_request = 1; if( to_us > 0 ) tmrstart = platform_timer_op( timer_id, PLATFORM_TIMER_OP_START, 0 ); while( 1 ) { if( elua_uip_accept_request == 0 ) break; if( to_us > 0 && platform_timer_get_diff_us( timer_id, tmrstart, platform_timer_op( timer_id, PLATFORM_TIMER_OP_READ, 0 ) ) >= to_us ) { elua_uip_accept_request = 0; break; } } *pfrom = elua_uip_accept_remote; return elua_uip_accept_sock;}
开发者ID:Linux-enCaja,项目名称:robotica,代码行数:33,
示例5: web_initvoid web_init(void){ fls = newHashObject(); fls->addIndexString(fls, "/index.html", indexPage); uip_listen(HTONS(80));}
开发者ID:scuzzycheese,项目名称:micro,代码行数:7,
示例6: telnetd_init/*---------------------------------------------------------------------------*/voidtelnetd_init(void){ uip_listen(HTONS(23)); memb_init(&linemem); shell_init();}
开发者ID:JKcompute,项目名称:395_midi_controller,代码行数:8,
示例7: httpd_init/*-----------------------------------------------------------------------------------*/void httpd_init(void){ fs_init(); /* Listen to port 80. */ uip_listen(HTONS(80));}
开发者ID:navyzhou926,项目名称:test.2,代码行数:8,
示例8: socket_listen//port number must be in network order (use htons() )bool socket_listen( unsigned short port, file_handle_t (*accept_callback)(u16_t local_port, u16_t *remote_address, u16_t remote_port) ){ int i = uip_listen( port ); if( i < 0 ) return false; listenports[i] = accept_callback; return true;}
开发者ID:Random1984,项目名称:dangerous-prototypes-open-hardware,代码行数:8,
示例9: HTTPServerApp_Init/** Initialization function for the simple HTTP webserver. */void HTTPServerApp_Init(void){ /* Listen on port 80 for HTTP connections from hosts */ uip_listen(HTONS(HTTP_SERVER_PORT)); /* Mount the dataflash disk via FatFS */ f_mount(0, &DiskFATState);}
开发者ID:emcute0319,项目名称:ir-usb-kbd,代码行数:9,
示例10: httpd_init//*****************************************************************************//// Initialize the web server.//// Starts to listen for incoming connection requests on TCP port 80.////*****************************************************************************voidhttpd_init(void){ // // Listen to port 80. // uip_listen(HTONS(80));}
开发者ID:MrDoomBringer,项目名称:stellaris-enc28j60,代码行数:15,
示例11: httpd_initvoidhttpd_init(void) { uip_listen(HTONS(80)); PIN_UNUSED(j1[0]); PIN_UNUSED(j1[1]); // PB5 SETUP_PIN(j1[2], GPIO_PORTB_BASE, GPIO_PIN_0, CONFIG_INPUT); SETUP_PIN(j1[3], GPIO_PORTB_BASE, GPIO_PIN_1, CONFIG_INPUT); SETUP_PIN(j1[4], GPIO_PORTE_BASE, GPIO_PIN_4, CONFIG_INPUT); PIN_UNUSED(j1[5]); // PE5 PIN_UNUSED(j1[6]); // PB4 PIN_UNUSED(j1[7]); // PA5 SETUP_PIN(j1[8], GPIO_PORTA_BASE, GPIO_PIN_6, CONFIG_INPUT); SETUP_PIN(j1[9], GPIO_PORTA_BASE, GPIO_PIN_7, CONFIG_INPUT); PIN_UNUSED(j2[0]); // GND SETUP_PIN(j2[1], GPIO_PORTB_BASE, GPIO_PIN_2, CONFIG_INPUT); SETUP_PIN(j2[2], GPIO_PORTE_BASE, GPIO_PIN_0, CONFIG_INPUT); PIN_UNUSED(j2[3]); // PF0 -- not used PIN_UNUSED(j2[4]); // RESET PIN_UNUSED(j2[5]); // PB7 -- used by SSI2 PIN_UNUSED(j2[6]); // PB6 -- used by SSI2 SETUP_PIN(j2[7], GPIO_PORTA_BASE, GPIO_PIN_4, CONFIG_INPUT); SETUP_PIN(j2[8], GPIO_PORTA_BASE, GPIO_PIN_3, CONFIG_INPUT); SETUP_PIN(j2[9], GPIO_PORTA_BASE, GPIO_PIN_2, CONFIG_INPUT); PIN_UNUSED(j3[0]); // 5.0V PIN_UNUSED(j3[1]); // GND SETUP_PIN(j3[2], GPIO_PORTD_BASE, GPIO_PIN_0, CONFIG_INPUT); SETUP_PIN(j3[3], GPIO_PORTD_BASE, GPIO_PIN_1, CONFIG_INPUT); SETUP_PIN(j3[4], GPIO_PORTD_BASE, GPIO_PIN_2, CONFIG_INPUT); SETUP_PIN(j3[5], GPIO_PORTD_BASE, GPIO_PIN_3, CONFIG_INPUT); SETUP_PIN(j3[6], GPIO_PORTE_BASE, GPIO_PIN_1, CONFIG_INPUT); SETUP_PIN(j3[7], GPIO_PORTE_BASE, GPIO_PIN_2, CONFIG_INPUT); SETUP_PIN(j3[8], GPIO_PORTE_BASE, GPIO_PIN_3, CONFIG_INPUT); SETUP_PIN(j3[9], GPIO_PORTF_BASE, GPIO_PIN_1, CONFIG_OUTPUT); SETUP_PIN(j4[0], GPIO_PORTF_BASE, GPIO_PIN_2, CONFIG_OUTPUT); SETUP_PIN(j4[1], GPIO_PORTF_BASE, GPIO_PIN_3, CONFIG_OUTPUT); SETUP_PIN(j4[2], GPIO_PORTB_BASE, GPIO_PIN_3, CONFIG_INPUT); SETUP_PIN(j4[3], GPIO_PORTC_BASE, GPIO_PIN_4, CONFIG_INPUT); SETUP_PIN(j4[4], GPIO_PORTC_BASE, GPIO_PIN_5, CONFIG_INPUT); SETUP_PIN(j4[5], GPIO_PORTC_BASE, GPIO_PIN_6, CONFIG_INPUT); SETUP_PIN(j4[6], GPIO_PORTC_BASE, GPIO_PIN_7, CONFIG_INPUT); SETUP_PIN(j4[7], GPIO_PORTD_BASE, GPIO_PIN_6, CONFIG_INPUT); SETUP_PIN(j4[8], GPIO_PORTD_BASE, GPIO_PIN_7, CONFIG_INPUT); SETUP_PIN(j4[9], GPIO_PORTF_BASE, GPIO_PIN_4, CONFIG_INPUT); MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC); MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); configure_pins(j1, HEADER_SIZE); configure_pins(j2, HEADER_SIZE); configure_pins(j3, HEADER_SIZE); configure_pins(j4, HEADER_SIZE);}
开发者ID:cubeberg,项目名称:HomeAutomation,代码行数:58,
示例12: srv_listenvoid srv_listen(uint16_t port){ // Check if a listening point was already open for(U8 i=0;i<MAX_SOCK_NUM;i++) if(uip_listenports[i] == HTONS(port)) return; // Start listening uip_listen(HTONS(port));}
开发者ID:AlfavilleLM,项目名称:souliss,代码行数:10,
示例13: iot_tcp_app_init/* * The initialization function. We must explicitly call this function * from the system initialization code, some time after uip_init() is * called. */voidiot_tcp_app_init(void){ /* We start to listen for connections on TCP port 7681. */ uip_listen(HTONS(IoTpAd.ComCfg.Local_TCP_Srv_Port));#if CFG_SUPPORT_TCPIP_ROBUST_TEST uip_listen(HTONS(7684));#endif#if UIP_HTTP_CLIENT_SUPPORT //http client setting //webclient_get("192.168.1.100", HTTP_SERVER_DEFAULT_PORT, "/MT7681_sta_header.bin"); webclient_get("192.168.2.1", HTTP_SERVER_DEFAULT_PORT, "/index.html"); //printf_high("http client port:%d/n", http_clientPort); uip_listen(HTONS(http_clientPort));#endif#if TCP_CLI_APP1_ENABLE tcp_cli_app1_init();#endif#if TCP_SRV_APP1_ENABLE uip_listen(HTONS(TCP_SRV_APP1_LOCAL_PORT));#endif#if MY_TCP_SRV_APP_ENABLE uip_listen(HTONS(MY_TCP_SRV_APP_LOCAL_PORT));#endif#if UIP_CLOUD_SERVER_SUPPORT uip_listen(HTONS(CLOUD_TCP_SERVER_PORT)); cloud_para_check_connect();#endif}
开发者ID:CrippledBytes,项目名称:CentralHeater,代码行数:40,
示例14: xtcpd_listenvoid xtcpd_listen(int linknum, int port_number, xtcp_protocol_t p){ if (p == XTCP_PROTOCOL_TCP) { register_listener(tcp_listeners, linknum, port_number, NUM_TCP_LISTENERS); uip_listen(HTONS(port_number)); } else { register_listener(udp_listeners, linknum, port_number, NUM_UDP_LISTENERS); uip_udp_listen(HTONS(port_number)); } return;}
开发者ID:aritec,项目名称:sc_xtcp,代码行数:13,
示例15: netSockListenvoid netSockListen(UosFile* file){ P_ASSERT("netSockListen", file->fs->cf == &netFSConf); NetSock* sock = (NetSock*)file->fsPriv; posMutexLock(sock->mutex); sock->state = NET_SOCK_LISTENING; posMutexUnlock(sock->mutex); posMutexLock(uipMutex); uip_listen(sock->port); posMutexUnlock(uipMutex);}
开发者ID:AriZuu,项目名称:picoos-net,代码行数:13,
示例16: httpd_init/** * /brief Initialize the web server * * This function initializes the web server and should be * called at system boot-up. */voidhttpd_init(void){#if PORT_APP_MAPPER uint8_t index = 0; while (index < HTTPD_MAX_CONNECTIONS) { httpd_state_list[index].state = STATE_UNUSED; index++; }#endif uip_listen(HTONS(80));}
开发者ID:jaseg,项目名称:avr-uip,代码行数:19,
示例17: ftpd_init/* * The initialization function. We must explicitly call this function * from the system initialization code, after uip_init() is called. */void ftpd_init(void){ u16_t i; // Initialise the ftp daemons for (i = 0; i < NUM_FTP_DAEMONS; i++) { ftpd_state[i].state = FTP_UNUSED; ftpd_state[i].pasvport = PASV_PORT_OFFSET + i; } /* We start to listen for connections on the FTP control port. */ uip_listen(HTONS(FTPD_CONTROL_PORT));}
开发者ID:Lzyuan,项目名称:STE-LPC1768-,代码行数:18,
示例18: DHCPServerApp_Init/** Initialization function for the DHCP server. */void DHCPServerApp_Init(void){ /* Listen on port 67 for DHCP server connections from hosts */ uip_listen(HTONS(DHCP_SERVER_PORT)); /* Create a new UDP connection to the DHCP server port for the DHCP solicitation */ struct uip_udp_conn* BroadcastConnection = uip_udp_new(&uip_broadcast_addr, HTONS(DHCP_CLIENT_PORT)); /* If the connection was successfully created, bind it to the local DHCP client port */ if (BroadcastConnection != NULL) uip_udp_bind(BroadcastConnection, HTONS(DHCP_SERVER_PORT)); /* Set all IP addresses as unleased */ memset(LeasedIPs, 0x00, sizeof(LeasedIPs));}
开发者ID:Steffen-Engel,项目名称:lufa,代码行数:16,
示例19: tcp_listen/*---------------------------------------------------------------------------*/voidtcp_listen(uint16_t port, uint8_t conn_id){ static unsigned char i; struct listenport *l; l = s.listenports; for(i = 0; i < UIP_LISTENPORTS; ++i) { if(l->port == 0) { l->port = port; l->conn_id = conn_id; uip_listen(port); break; } ++l; }}
开发者ID:kamejoko80,项目名称:emb6,代码行数:18,
示例20: setup_serversstatic void setup_servers(){ if (webserver_enabled) { // Initialize the HTTP server, listen to port 80. httpd_init(); printf("Webserver initialized/n"); } if (telnet_enabled) { // Initialize the telnet server Telnetd::init(); printf("Telnetd initialized/n"); } // sftpd service, which is lazily created on reciept of first packet uip_listen(HTONS(115));}
开发者ID:2thetop,项目名称:Smoothieware,代码行数:17,
示例21: tcp_listen/*---------------------------------------------------------------------------*/voidtcp_listen(u16_t port, uip_app_handle_t p){ static unsigned char i; struct listenport *l; l = s.listenports; for(i = 0; i < UIP_LISTENPORTS; ++i) { if(l->port == 0) { l->port = port; l->p = p; uip_listen(port); break; } ++l; }}
开发者ID:lepton-distribution,项目名称:lepton-root.scions,代码行数:18,
示例22: tcp_listen/*---------------------------------------------------------------------------*/voidtcp_listen(uint16_t port){ static unsigned char i; struct listenport *l; l = s.listenports; for(i = 0; i < UIP_LISTENPORTS; ++i) { if(l->port == 0) { l->port = port; l->p = PROCESS_CURRENT(); uip_listen(port); break; } ++l; }}
开发者ID:kenog,项目名称:contiki-inga,代码行数:18,
示例23: Network_Configuration/** * @brief Configure Network * @param None * @retval None */void Network_Configuration(void){ struct uip_eth_addr mac = {{ 0xeb, 0xa0, 0x00, 0x00, 0x00, 0x00 }}; enc28j60_init(mac.addr); uip_init(); uip_arp_init(); uip_setethaddr(mac); uip_ipaddr_t ipaddr; uip_ipaddr(ipaddr, 192, 168, 0, 100); uip_sethostaddr(ipaddr); uip_ipaddr(ipaddr, 255, 255, 255, 0); uip_setnetmask(ipaddr); uip_ipaddr(ipaddr, 192, 168, 0, 1); uip_setdraddr(ipaddr); uip_listen(HTONS(4000));}
开发者ID:alemoke,项目名称:theLEDStripControl,代码行数:24,
示例24: TcpIpInitvoid TcpIpInit(void){ uint8_t IpAddress[4]; uint8_t NetMask[4]; uint8_t RouterIp[4]; /* Set up the network interface */ UserIoIpSettingsGet(IpAddress, NetMask, RouterIp); nic_init(); uip_init(IpAddress, NetMask, RouterIp); uip_arp_init(); uip_listen(HTONS(ETH_LOC_BUFFER_BUFFER_TCP_PORT)); TcpIpUipTimerCounter = 0; TcpIpUipArpTimerCounter = 0; TCCR0B = (1 << CS01) | (1<<CS00); TIMSK0 |= (1<<TOIE0);}
开发者ID:AndTH,项目名称:GCA,代码行数:19,
示例25: xtcpd_listen/* -------------------------------------------------------------------------- */void xtcpd_listen(int linknum, int port_number, xtcp_protocol_t p){ switch(p){ case XTCP_PROTOCOL_TCP: register_listener(tcp_listeners, linknum, port_number, NUM_TCP_LISTENERS); uip_listen(HTONS(port_number)); break; case XTCP_PROTOCOL_UDP: register_listener(udp_listeners, linknum, port_number, NUM_UDP_LISTENERS); uip_udp_listen(HTONS(port_number)); break; default: PRINTF("xtcpd_listen: Unknown protocol."); break; } return;}
开发者ID:ajwlucas,项目名称:lib_xtcp,代码行数:21,
示例26: xMBTCPPortInit/* ----------------------- Begin implementation -----------------------------*/BOOLxMBTCPPortInit( USHORT usTCPPort ){ BOOL bOkay = FALSE; USHORT usPort; if( usTCPPort == 0 ) { usPort = MB_TCP_DEFAULT_PORT; } else { usPort = (USHORT)usTCPPort; } // 侦听端口 502端口 uip_listen(HTONS(usPort)); bOkay = TRUE; return bOkay;}
开发者ID:kc87654321,项目名称:uip_freemodbus_tcp,代码行数:22,
示例27: elua_uip_init// Init applicationvoid elua_uip_init( const struct uip_eth_addr *paddr ){ // Set hardware address uip_setethaddr( (*paddr) ); // Initialize the uIP TCP/IP stack. uip_init(); uip_arp_init(); #ifdef BUILD_DHCPC dhcpc_init( paddr->addr, sizeof( *paddr ) ); dhcpc_request();#else elua_uip_conf_static();#endif resolv_init(); #ifdef BUILD_CON_TCP uip_listen( HTONS( ELUA_NET_TELNET_PORT ) );#endif }
开发者ID:Linux-enCaja,项目名称:robotica,代码行数:23,
示例28: zg_initvoid Server::init(pageServingFunction function) { // WiShield init zg_init();#ifdef USE_DIG0_INTR attachInterrupt(0, zg_isr, LOW);#endif#ifdef USE_DIG8_INTR // set digital pin 8 on Arduino // as ZG interrupt pin PCICR |= (1<<PCIE0); PCMSK0 |= (1<<PCINT0);#endif while(zg_get_conn_state() != 1) { zg_drv_process(); } // Start the stack stack_init(); // Store the callback function for serving pages // and start listening for connections on port 80 if // the function is non-null callbackFunc = function; if (callbackFunc) { // Listen for server requests on port 80 uip_listen(HTONS(80)); }#ifdef DEBUG verbose = true; Serial.println("WiServer init called");#endif // DEBUG}
开发者ID:hmeyer,项目名称:RadioClock,代码行数:37,
示例29: httpd_initvoidhttpd_init(void){ uip_listen(HTONS(HTTPD_PORT), httpd_main); uip_listen(HTONS(HTTPD_ALTERNATE_PORT), httpd_main);}
开发者ID:AnDann,项目名称:ethersex,代码行数:6,
注:本文中的uip_listen函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ uip_newdata函数代码示例 C++ uip_is_addr_unspecified函数代码示例 |