C++ UDP Socket port multiplexing -
how can create client udp socket in c++ can listen on port being listened application? in other words, how can apply port multiplexing in c++?
i want listen on 1 port
you can sniffer. ignore packets different ports.
i might need stop sending out particular packets, because program send instead of original application
okay, here suggest discard sniffers, , use mitm technique.
you'll need rely on prerouting firewall rule divert packets "proxy" application. assuming udp, linux, iptables, , "proxy" running on same host, here's "proxy" needs do:
1. add firewall rule divert packets (do manually, if prefer):
iptables -t nat -a prerouting -i <iface> -p <proto> --dport <dport> -j redirect --to-port <newport>
2. bind , listen on <newport>
.
3. relay traffic between 2 endpoints (client, , original destination). if you're running "proxy" on different host, use getsockopt so_original_dst
retrieve original destination address.
it might sound tricky, but... yeah, that's because it's bit tricky :-) consult firewall documentation if assumption diverges.
Comments
Post a Comment