This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

UDP Issues

Greetings All,

I am using the RL_ARM TCP net library in order to establish a connection with the LPC2468.

I have the following code to initialize the UDP connection:

        static U8 retval = 0xFF;

        udp_soc = udp_get_socket (0, UDP_OPT_SEND_CS | UDP_OPT_CHK_CS, udp_callback);

        if ( udp_soc !=  0 )
        {
                retval = udp_open(udp_soc,0);
        }

The implementation of the udp_callback function is:


        delayMs(500);

        Buffer = udp_get_buf (count);

        memcpy(Buffer, ptr,count);

        retval = udp_send (udp_soc, _remip, _remport, Buffer, count);

   return (0);

_remip is the port that is autoselected, and _remip is the ipaddress passed to the function.

The udp test program that I have is ServerTalk, and allows me to connect to an ip adress and not specify a port, however, any data I attempt to send to the UDP connection is never recieved in my code.

I have switched things around, where I specify a port in the code, and it works better, but really want to not have to do that.

Has anyone ever run into similar issues, or am I doing something fundamentally wrong?

Any help is appreciated.

Thanks,

Parents
  • I don't use the Keil stack, so I'm a bit confused here. Do you think you have written the server side (the one that listens to connects and may send back an answer) or the client side (the side that connects to a server, and potentially waits for an answer).

    _remip, _remport would be the IP number and port for the remote side, and the names suggests that it is the server who gets to know the IP number and port of the client who did connect to the server.

    But the server itself must always have a hardcoded port, or the client wouldn't be able to know what UDP port to send the initial message to.

    The open issue here is what you mean with "and allows me to connect to an ip adress and not specify a port". A client must always specify a destination port. But it can let the TCP stack select the local port. A server must always listen on a fixed port. And if sending an answer back, it can check the source port and source IP of the received data to know where to send answers back.

    So what did you mean with "and not specify a port"? What side did you talk about? And about initial message, or response back from server?

Reply
  • I don't use the Keil stack, so I'm a bit confused here. Do you think you have written the server side (the one that listens to connects and may send back an answer) or the client side (the side that connects to a server, and potentially waits for an answer).

    _remip, _remport would be the IP number and port for the remote side, and the names suggests that it is the server who gets to know the IP number and port of the client who did connect to the server.

    But the server itself must always have a hardcoded port, or the client wouldn't be able to know what UDP port to send the initial message to.

    The open issue here is what you mean with "and allows me to connect to an ip adress and not specify a port". A client must always specify a destination port. But it can let the TCP stack select the local port. A server must always listen on a fixed port. And if sending an answer back, it can check the source port and source IP of the received data to know where to send answers back.

    So what did you mean with "and not specify a port"? What side did you talk about? And about initial message, or response back from server?

Children