| Dart Home | PowerTCP Winsock for ActiveX | Custom Development | Reply | PowerTCP Winsock for ActiveX Topics | Forums |
| Author | Forum: PowerTCP Winsock for ActiveX Topic: Getting the Local IP address |
| chris@digitalinsights.com From: San Clemente, CA USA Posts: 73 Member Since: 11/03/03 |
posted April 5, 2004 7:53 PM Using the Winsock control, is there a way to get the local IP address that was used to connect? I know about the LocalAddress property, but it returns a blank string unless you specify the local IP address when you connect. The windows winsock control will return the local address used to connect by using winsock1.ipaddress. |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted April 5, 2004 8:11 PM Using the SecureTcp Client sample I changed the following line in the state event: Caption = "Connected to " + Tcp1.RemoteAddress + " on port " + CStr(Tcp1.RemotePort) To: Caption = "Local Address " + Tcp1.LocalAddress When I connected the caption read: Local Address: 127.0.0.1 Please explain how you got it to be a blank string. |
| chris@digitalinsights.com From: San Clemente, CA USA Posts: 73 Member Since: 11/03/03 |
posted April 6, 2004 11:31 AM Are you using a blank string for the Local IP address when you connect. For example: sIPAddress="" Tcp1.Connect sSMTPServer, 25, sIPAddress As you know, using the blank string causes the control to use the primary IP on the machine. It I explicitly set sIPAddress to an address, then it works. |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted April 6, 2004 11:43 AM Yes, I was. I tried it again here at work and I got the IP of my machine. I think it's completely dependent on the way TCP-IP is set up on the machine. We don't have control over it. |
| chris@digitalinsights.com From: San Clemente, CA USA Posts: 73 Member Since: 11/03/03 |
posted April 6, 2004 6:57 PM Tony, I got it to work, my fault, but it is returning 127.0.0.1 which does not do any good. Is this the address it will return always? If so, do you agree I will need to find out the primary IP address by other means? |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted April 6, 2004 7:30 PM No. As I said, it returns 127.0.0.1 on my machine at home and the IP I expect on my machine at work. We just give you whatever winsock does when we bind. I do not know how to control it other than to specify the address implicity. If I were you I would get the address using our system object and then use it when you connect. You can see the system object in use in the about boxes of our samples. |
| Reply | PowerTCP Winsock for ActiveX Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|