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

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -

PostgreSQL 9.x - pg_read_binary_file & inserting files into bytea -