Keil Logo

Technical Support

On-Line Manuals

RL-ARM User's Guide (MDK v4)

RL-RTX RL-FlashFS RL-TCPnet TCP Socket Opening TCP Connection TCP Active Open TCP Passive Open Sending TCP Data Example for Sending Data Multiple TCP Connections UDP Socket Opening UDP Connection Sending UDP Data When DHCP Enabled When ARP Cache Empty Example for Sending Data IP Multicasting Multiple UDP Connections Configuring RL-TCPnet Static Configuration System Definitions Ethernet Network Interface PPP Network Interface SLIP Network Interface UDP Socket TCP Socket BSD Socket HTTP Server Telnet Server TFTP Server TFTP Client FTP Server FTP Client DNS Client SMTP Client SNMP Agent SNTP Client Error Function Runtime Configuration Library Files Using RL-TCPnet Stand Alone With RTX Kernel Event Driven Operation IP Address Assignment Ethernet Interface PPP Interface SLIP Interface Localhost Applications HTTP Server Script Language CGI Functions Ajax Support Using XML XML Example How it works SOAP Support SOAP Interface Large POST Messages Web Pages Default Page Error Pages Web on SD Card Web Update File System Interface Http Caching How it works Internal Web External Web Multi-user Authentication Using RAM File System FCARM File Converter PRINT Directive NOPRINT Directive PAGEWIDTH Directive PAGELENGTH Directive ROOT Directive Telnet Server Command Line Interface Multi-user Authentication Sending Reply Message Short Reply Long Reply Continuous Screen Update TFTP Server File System Interface TFTP Client File System Interface FTP Server File System Interface Multi-user Authentication Supported Commands FTP Client File System Interface SMTP Client SNMP Agent MIB Database MIB Interface MIB Entry MIB Table DNS Resolver Starting DNS Device Drivers Ethernet Driver Interrupt Mode Modem Driver Serial Driver Using Serial Link Cable Connection Modem Connection Windows Dial-up Add Direct Serial Link New Dial-up Connection Configure PPP Dial-up Configure SLIP Dial-up Debugging Enabling Debug Debug Level Redirecting Output Function Overview BSD Routines CGI Routines Ethernet Routines FTP Routines HTTP Routines IGMP Routines Miscellaneous Routines Modem Routines PPP Routines Serial Routines SLIP Routines SMTP Routines SNMP Routines System Functions TCP Routines Telnet Routines TFTP Routines UDP Routines RL-CAN RL-USB Example Programs Library Reference Appendix

When DHCP Enabled

A Dynamic Host Configuration Protocol (DHCP) client automatically configures the network parameters for the application. This normally takes some time after startup.

When the network traffic is low and a DHCP server is idle, automatic device configuration is finished in less than 60 msec. But it is possible, on high traffic networks, that this configuration could take a lot longer by up to a couple of seconds. Any attempt to send an UDP data packet during that time will fail and the UDP data packet will be lost.

Communications must wait until the local IP address is configured. This can be done by simply monitoring the IP address in the localm structure, which holds all the network configuration parameters.

When the DHCP client starts, it copies a default Local IP address, which is set in the configuration, to a local buffer and clears the assigned IP address for the ethernet adapter. The DHCP client then tries to acquire the proposed IP address in the DHCP negotiation process. To see when the DHCP configuration procedure has finished, it is enough to monitor the assigned IP address of the ethernet adapter.

The whole procedure is required only when we want to send UDP data. For receiving UDP packets, this is not a problem because the application will not accept any IP packet until the ethernet adapter IP address is assigned.

Here is an example for the send_data() function from the UDP example modified for enabled DHCP:

void send_data (void) {
  static const U8 rem_IP[4] = {192,168,0,100};
  U8 *sendbuf;

  if (wait_ack == __TRUE) {
    return;
  }
  if (mem_test (localm[NETIF_ETH].IpAdr, 0, 4) == __TRUE) {
    /* IP address not yet assigned by DHCP. */
    return;
  }
  if (bindex < 128) {
    sendbuf = udp_get_buf (512);
    for (i = 0; i < 512; i += 2) {
      sendbuf[i]   = bcount >> 8;
      sendbuf[i+1] = bcount & 0xFF;
    }
    udp_send (udp_soc, rem_IP, 1000, sendbuf, 512);
  }
}

 

  • The example assumes that the DHCP Client for Ethernet Network Interface is enabled in the configuration.
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.