View Single Post
Old Apr 7th, 2008, 11:28 PM   #2
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 763
Rep Power: 3 Jimbo is on a distinguished road
Re: promiscious sockets

Quote:
Originally Posted by hbe02 View Post
Now so far, I know that when u want to recieve somehting u open a socket on a certain port. Now in my case how should the sockets be different?
What do you mean, be different? A socket is basically an ear on the network. If you want to hear more, you need more sockets. If you're just simming, you could use an extra later of abstraction to break your single socket into a couple virtual sockets.

Quote:
and how can i retain the destination IP so that i can forward the packet. This should be the same socket operation of a firewall i think.
Are you imitating a firewall or a router? Most routing of packets only have the final destination and the original source of the packet. The steps in the middle use MAC addressing to get around, and only read the IP to figure out whether to turn right or left.

For a firewall, though, you [can] read up a little further into the packet and decide whether to accept it based on other traits, such as port number, source IP address, etc...

With NAT your router keeps a mapping of inner IP addresses to outside facing IP addresses (e.g. you have the 212.13.49.0/24 network, and you remap each one into 192.168.0.0/24). With PAT, your router keeps a mapping of inner IP addresses to outside facing ports (e.g. you have 212.13.49.0/24 and you remap it to 192.168.0.3:80, 192.168.0.3:115, 192.168.0.4:12345, etc...). NAT and PAT are not necessarily firewall functions.

Quote:
can anyone suggest any reading material or google keyword or similar project for me to look at.
Back when I took Cisco classes in high school, there was a kinda similar thing to simulate a multi-router network, but it was on one computer, no need for sockets. I can't remember the name though
__________________
<insert disclaimer here>
<insert shameless plug for Visual Studio here>
Jimbo is offline   Reply With Quote