Simple pass-through application
I have a computer with 2 network connectors on it, and would like to write a very simple application to pass data from one connector to the other. This means that if I connect one connector to a router and the other to another computer, the second computer should behave as if it were directly connected to the router because the multi-homed machine is simply passing data back and forth.
This code could form the basis of an application to log all of the data passed back and forth or to possibly filter the traffic that passes through. This is what I'd ultimately like to do, but for now, I'm still struggling with how to simply pass data back and forth, and do things like opening ports when requested.
I'm not sure whether this is a very simple application (I think it is) or a very complex one. Anyone have any ideas how to do this simply? Any references to anyything like this?
Sander Smith
[925 byte] By [
smithsaa] at [2007-10-2 20:29:03]

In windows there is a way to bridge two network connections. You just have to right click on the connection and in the popup meny there is comething called bridge.
Also there are many routing softwares that can do this.
Do you really want to do this on your own or just get the job done using some existing tool
LRMKa at 2007-7-13 23:11:58 >

Maybe I'm not making myself clear about what I want to do.
Let's say I have a computer with two NICs. In one of the NICs I'd like to plug a network-enabled web cam into. This web cam has a web server built into it, and will try to open port 80 for inbound connections. My computer should allow the web cam to "think" it is connected to a router and allow this to happen, and open up port 80 on the other NIC that's attached to a router on the real internet. Any browser that connects to this port 80 will have its requests simply forwarded to the web cam. Needless to say, anything that the web cam tries to do such as send data out should be mimicked on the on the interface. In this way, we've built a simple pass-through program that transparently passes data back and forth.
It would seem that writing a little application to simply pass data from one NIC to the other should be very simple. Why would I want this? Well, I really don't. It is just the first step to building the real program where I allow some kind of filtering to happen on the data going by. For instance, imagine the web cam has no zoom feature. My program in the middle can provide this feature by watching the data go by, and simply zooming in on the images that are being returned. This is why using some existing program won't work for me: I want to be able to control the filtering in the middle.
Anyone have any ideas on how to do this simply?
Sander
What you have described is a firewall that does NAT and port forwarding. Many of these firewalls also have filtering and logging capabilities. There is no reason to write the application you describe, as you would inevitably miss many of the details that have already been established.
Brian