1

I've developed a hardware (client,src ip 192.168.01.200 :9652, des ip 192.168.01.100 :9652) that reply ARP and ICMP request from pc and send UDP frame, i can check the UDP frame , ARP and icmp reply in wireshark and all of these frames are ok but i can't receive anything in my software,

in pc side (server) i set up ip address 192.168.01.100 and i wrote delphi code for receiving udp frame by using indy10 , and then i check On_udp_read event for receiving data but this event never occur,

sever (pc):

  udpserver.Active := True;
  binding:=udpserver.bindings.add;
  binding.IP:= '192.168.01.100'; // my computer IP
  binding.Port:=9652;
1
  • 2
    I know nothing about Delphi, but try setting it active last instead of first.
    – user207421
    Feb 24, 2015 at 8:46

1 Answer 1

1

You need to set up the Bindings collection before you activate the server, not after:

//udpserver.Active := True;
binding := udpserver.Bindings.Add;
binding.IP := '192.168.01.100';
binding.Port := 9652;
udpserver.Active := True; // <-- move down here

If the Bindings collection is empty when you activate the server, it will create a default item that is bound to IP 0.0.0.0 (IPv4) or ::1 (IPv6) on the TIdUDPServer.DefaultPort, which is 0 by default. So you would end up binding to a random OS-assigned port, unless you set the DefaultPort beforehand, eg:

udpserver.DefaultPort := 9652;
udpserver.Active := True;
9
  • after i shift it to the end and also disabled Antivirus and windows firewall , I could't receive UDP frame in my software again, when I check "netstat -e" or "wireshark" I can see received the udp frame, the netstat -e show the computer didn't receive "unknown protocols frames " but received "discards frames",
    – Sorena
    Feb 25, 2015 at 2:28
  • If frames are being discarded, then their destination does not match any active socket. You might want to use netstat to also verify that your udp server IP/port is actually open and in a listening state. Feb 25, 2015 at 6:15
  • I've implemented my hardware to reply only to ARP and ICMP and make and send UDP frame,
    – Sorena
    Feb 25, 2015 at 8:42
  • The only other thing I can think of is if the destination MAC on the UDP packets (00:1e:68:4d:b7:b0) does not match the MAC on the NIC that has IP 192.168.1.100. Did you check that yet? You can use ipconfig /all for that. Feb 25, 2015 at 17:41
  • yes that's match,i can transfer udp packet between two pc, but i couldn't do that between a hardware and pc, i don't know what's the problem, maybe hardware should to reply to some packet that send by pc first, and then the connection will be established,
    – Sorena
    Feb 26, 2015 at 0:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.