By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,630 Members | 1,910 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,630 IT Pros & Developers. It's quick & easy.

Sockets question

P: n/a
This one is going to be hard to explain. First the question and then the
background.

If you have a box bound to two subnets through two NICs, can you code your
socket listener to listen to a particular NIC? I see nothing in the class
that provides this. It currently appears that the listener is, by default,
bound to only one NIC, as it was working prior to moving the machine to be
bound to the gateway on the other subnet.

At this time, I have an alternative SOA solution (which requires a bit too
much coding for my likes), so I am just wondering how to ensure the listener
listens to both subnets (NICs) or how to ground it programmatically to one
subnet (NIC). Other solutions are welcome, but that is the primary question.
--------------------------------------------------------------
You can stop reading here if you do not want the background:
--------------------------------------------------------------

On the old network, everything was on a single subnet. This is impossible
now, as we have to set up both a hardware VPN and a software VPN. Due to set
up of the VPNs, or VPN devices (one a Cisco ASA, the other a Linux box), I
cannot set up the software VPN to listen through the hardware device, so we
end up with two gateways. This is the reason for two subnets. It might be
possible to figure out how to get the software VPN through the hardware
device, but it is a vendor solution, which means I am not directly feeding
the person who has to make that change.

The solution worked on a single subnet. The box now sites with NIC one set
up to talk on the subnet with the software VPN machine as its gateway. This
is the "primary NIC" and "primary network". It has a second NIC that sits on
another subnet, where the application server sits. I can move the app server
(web apps only currently) to the other subnet, but this only delays having
to solve this problem, as we will have to work with a VPN on the hardware
device soon and the same applications will have to talk to it. That means
moving the web server to the second subnet is a non-solution for long term.

I can solve this with a SOA solution (web service of some sort: ASMX, WCF),
but all of the web applications will have to change. I then have the web
service talk to the service in the same manner the web applications
currently do. Due to the way the vendor coded his libraries (there is an
unintentional coupling through said libraries), there are a few gotchas in
this approach, but they can be overcome with time.

But if there is a way to tell a listener which network to listen to (which
NIC to listen to), that solves the problem. I am not completely sure
(scientifically) the listener cannot listen to 2 NICs, but it appears to be
the case. A few days back, when everything was on one subnet (talking to the
hardware VPN), everything worked. It now fails. The only change was
grounding the box with the listener on another subnet.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************

Oct 2 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Oct 2, 9:10 am, "Cowboy \(Gregory A. Beamer\)"
<NoSpamMgbwo...@comcast.netNoSpamMwrote:
This one is going to be hard to explain. First the question and then the
background.

If you have a box bound to two subnets through two NICs, can you code your
socket listener to listen to a particular NIC? I see nothing in the class
that provides this. It currently appears that the listener is, by default,
bound to only one NIC, as it was working prior to moving the machine to be
bound to the gateway on the other subnet.
You can especify to which endpoint the connection will be attached too
(or to all endpoints) as a matter of fact the version of the
TcpListener that only accept a port is marked deprecaetd for a whie
now.
At this time, I have an alternative SOA solution (which requires a bit too
much coding for my likes), so I am just wondering how to ensure the listener
listens to both subnets (NICs) or how to ground it programmatically to one
subnet (NIC). Other solutions are welcome, but that is the primary question.
--------------------------------------------------------------
You can stop reading here if you do not want the background:
--------------------------------------------------------------
Ok, I did :)
Oct 2 '08 #2

P: n/a
I caught that after firing off the question. Duh!

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
"Ignacio Machin ( .NET/ C# MVP )" <ig************@gmail.comwrote in
message
news:18**********************************@m45g2000 hsb.googlegroups.com...
On Oct 2, 9:10 am, "Cowboy \(Gregory A. Beamer\)"
<NoSpamMgbwo...@comcast.netNoSpamMwrote:
>This one is going to be hard to explain. First the question and then the
background.

If you have a box bound to two subnets through two NICs, can you code
your
socket listener to listen to a particular NIC? I see nothing in the class
that provides this. It currently appears that the listener is, by
default,
bound to only one NIC, as it was working prior to moving the machine to
be
bound to the gateway on the other subnet.

You can especify to which endpoint the connection will be attached too
(or to all endpoints) as a matter of fact the version of the
TcpListener that only accept a port is marked deprecaetd for a whie
now.
>At this time, I have an alternative SOA solution (which requires a bit
too
much coding for my likes), so I am just wondering how to ensure the
listener
listens to both subnets (NICs) or how to ground it programmatically to
one
subnet (NIC). Other solutions are welcome, but that is the primary
question.
>--------------------------------------------------------------
You can stop reading here if you do not want the background:
--------------------------------------------------------------

Ok, I did :)
Oct 2 '08 #3

P: n/a
Oh, I forgot to say thank you. Thank you!

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
"Ignacio Machin ( .NET/ C# MVP )" <ig************@gmail.comwrote in
message
news:18**********************************@m45g2000 hsb.googlegroups.com...
On Oct 2, 9:10 am, "Cowboy \(Gregory A. Beamer\)"
<NoSpamMgbwo...@comcast.netNoSpamMwrote:
>This one is going to be hard to explain. First the question and then the
background.

If you have a box bound to two subnets through two NICs, can you code
your
socket listener to listen to a particular NIC? I see nothing in the class
that provides this. It currently appears that the listener is, by
default,
bound to only one NIC, as it was working prior to moving the machine to
be
bound to the gateway on the other subnet.

You can especify to which endpoint the connection will be attached too
(or to all endpoints) as a matter of fact the version of the
TcpListener that only accept a port is marked deprecaetd for a whie
now.
>At this time, I have an alternative SOA solution (which requires a bit
too
much coding for my likes), so I am just wondering how to ensure the
listener
listens to both subnets (NICs) or how to ground it programmatically to
one
subnet (NIC). Other solutions are welcome, but that is the primary
question.
>--------------------------------------------------------------
You can stop reading here if you do not want the background:
--------------------------------------------------------------

Ok, I did :)
Oct 2 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.