Author Topic: about the udp get data from PC!  (Read 9731 times)

Offline tr111

  • Jr. Member
  • **
  • Posts: 72
    • View Profile
about the udp get data from PC!
« on: September 06, 2007, 09:08:51 AM »
hello:
      Now I can use the fnSendUDP to send the data!But I want to get the data from the udp! How Can I do!
      I know the  fnHandleUDP's received_ip_packet have data and Header.
I know  If I #define SUPPORT_SUBNET_BROADCAST .I will get the data that I send.

But I don't like to use the #define SUPPORT_SUBNET_BROADCAST ;

      I like this:
      when I send the data to the MCF52235 from PC:source part=1999;
destination port=1999
PC
send:11 22 33 44 55
      I want the MCF52235 can get the data 11 22 33 44 55 ,and send back to
PC:

source part=1999;destination port=1999

MCF5223  get and send :11 22 33 44 55

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: about the udp get data from PC!
« Reply #1 on: September 06, 2007, 12:04:44 PM »
Hi
I don't think that SUPPORT_SUBNET_BROADCAST is relevant here. This will allow IP to receive broadcasts to its subnet (for example, without it, IP will not accept 192.168.0.255 - a broadcast to the subnet 192.168.0.xxx. With it this will be accepted).

All UDP frames received for the port number of the UDP socket will cause the call back function (fnUDPListner in the demo project). The listener will be called with the event type UDP_EVENT_RXDATA.
The code in the demo project will send the received data back, as you would like it to be done.

Note that it is possible to check the IP address and port number of the sender and reject these if necessary.

Regards

Mark


Offline tr111

  • Jr. Member
  • **
  • Posts: 72
    • View Profile
Re: about the udp get data from PC!
« Reply #2 on: September 07, 2007, 10:15:55 AM »
Mark:
     You are right about the SUPPORT_SUBNET_BROADCAST !
     I have known how the use the udp! Thank very much!