I m able to retrieved active TCP and UDP connection using iphlpapi. The TCP Connection showing with source info(ip/port), Destination info(ip/port), state and process id. But for UDP Connection its no giving remote IP and port. That what i want to get. Any way to get destination information using source information or process id in Delphi or c++.
Asked
Active
Viewed 1,697 times
1
-
Are you writing an app like netstat? – kol Jul 19 '13 at 12:26
-
2UDP is connectionless -- so the only way to see the remote IP/Port is to capture the packets. Are you sure you're not looking at a UDP listener? – afrazier Jul 19 '13 at 12:28
-
@afrazier.. No I'm not looking for Udp listener. I'll try packet capture. Any Help for that. – Leo Live Jul 19 '13 at 12:50
1 Answers
2
UDP is a connectionless protocol. You can only get the local port that has been opened.
UPDATE: This applies for a static look at the port usage. However, if you have active UDP trafic you can still retrieve the remote endpoint.
User Ishmeet suggested uIP or LwIP in the comments.

cwin
- 956
- 1
- 7
- 14
-
1No, you can get the IP address, I have done this on uIP, also on LwIP, on the callback function you receive the IP address and port number from the packet received – Ishmeet Jul 19 '13 at 12:29
-
OK, I agree... if you have active traffic you can get the senders endpoint. But the simple port usage information is not enough. – cwin Jul 19 '13 at 12:37
-
void udp_recv(struct udp_pcb * pcb, void (* recv)(void * arg, struct udp_pcb * upcb, struct pbuf * p, struct ip_addr * addr, u16_t port), void * recv_arg) -->http://lwip.wikia.com/wiki/Raw/UDP – Ishmeet Jul 19 '13 at 13:09