0

I'm developing a windows application using VB.NET 2017, I need to connect to a web service on a server.

If the PC where the win app is running has two IP addresses, how to know using which IP address the win app connected to the web service?

I need to know that from the win app itself.

Steven Doggart
  • 43,358
  • 8
  • 68
  • 105
Imad Abu Hayyah
  • 434
  • 4
  • 13
  • 1
    How are you consuming the web service? At some point in the mix of objects used to connect to it, depending on how, exactly, you are consuming it, there should be endpoints representing your side and the server's side, giving you a starting point to obtain the IP of your consuming connection. – David W Jun 11 '19 at 13:30
  • I'm adding service reference in visual studio to the web service. – Imad Abu Hayyah Jun 11 '19 at 13:33
  • If that's how you're consuming it, that's using WCF. – Steven Doggart Jun 11 '19 at 13:42
  • So how to know using which IP the connection happened, from the win app? – Imad Abu Hayyah Jun 11 '19 at 13:45
  • Without seeing exactly how you are connecting to the service, we can't give you an exact answer. That's why I offered the generic comment; the IP used by your client will be exposed, somehow, via the code that you use to consume the service. The *exact syntax* of that depends on how you are consuming the service. Post some code that shows how you are consuming the web service. – David W Jun 11 '19 at 13:48
  • Oops. Sorry. I closed this as a duplicate when I think what you are asking is how to find out which address it's using, rather than specifying which one it should use. In any case, you might find the info in [this post](https://stackoverflow.com/questions/3249846/specify-the-outgoing-ip-address-to-use-with-wcf-client) helpful. – Steven Doggart Jun 11 '19 at 13:50
  • There's also [this one](https://stackoverflow.com/questions/93162/obtaining-client-ip-address-in-wcf-3-0) which is probably more applicable – Steven Doggart Jun 11 '19 at 13:53
  • Or even [this one](https://stackoverflow.com/questions/6332575/how-can-i-programmatically-get-the-binding-that-my-client-proxy-is-using) – Steven Doggart Jun 11 '19 at 13:54

0 Answers0