-
Dec 10th, 2017, 06:57 AM
#1
Thread Starter
Lively Member
Can't Telnet to public IP with Winsock client/server program, only localhost works
When I listen on port 2600 I can telnet "localhost 2600" and it connects just fine, but when I try to open a telnet connection to "MyPublicIPAddress 2600" it returns
Could not open connection to the host, on port 2600: Connect failed
I have allowed the .exe in Windows firewall in both incoming and outgoing but it still isn't working.
If programs like uTorrent can act as servers that allow incoming connections without doing anything in router settings, why can't my simple VB6/mswinsck.ocx program?
I am using VB6 and Windows 10.
-
Dec 10th, 2017, 08:51 AM
#2
Re: Can't Telnet to public IP with Winsock client/server program, only localhost work
Almost every home and small office router is left configured for use as a Network Address Translation gateway to permit a single public IP address to be shared by multiple client devices.
Software that wants to use NAT Traversal must use one or more techniques to accomplish this.
Some techniques involve IPv6, which we don't have good support for in VB6. Another is to manually configure port mapping via the router's admin interface. Another uses Windows libraries to access the UPnP interface of routers to perform a port mapping from the Public IP address to a client with a Private address. Still others involve "hole punching" techniques, and these don't work for every router so some software has several of them implemented and tries them in turn until one succeeds.
UPnP is the most viable for a VB6 program, but it requires that the router supports UPnP and has UPnP enabled. Some routers have this turned off by default, but most have it turned on these days.
Look for NAT UPnP examples in the CodeBank.
Firewall configuration on the PC is also required, of course.
-
Dec 10th, 2017, 11:28 AM
#3
Addicted Member
Re: Can't Telnet to public IP with Winsock client/server program, only localhost work
Something else too...If you're trying to connect to yourself through your public IP, the feature is called NAT Loopback, which is different than NAT Traversal. I've had this same problem before and it may be what you're experiencing. Not all routers are configured for it by default and some very old routers don't support it at all. You may want to go into your router's web GUI and see if you can find that setting somewhere.
Here's an old blog post about NAT Loopback:
http://www.networkwebcams.co.uk/blog...-nat-loopback/
-
Dec 11th, 2017, 06:24 AM
#4
Thread Starter
Lively Member
Re: Can't Telnet to public IP with Winsock client/server program, only localhost work
Thanks for your responses, guys. Sincerely. But, I must be missing something
What I'm actually trying to do is build a blockchain with nodes in classic VB for a proof of concept. I have ideas for blockchain I haven't seen done yet, so I want to build a functional working model in VB6 and then have it ported to a lower level language such as C or C++. If/when I clear this issue, I may end up trying to figure out how to import a math .dll to handle crunching numbers / encryption due to the speed limitations of VB6.
Originally Posted by dilettante
Almost every home and small office router is left configured for use as a Network Address Translation gateway to permit a single public IP address to be shared by multiple client devices.
Software that wants to use NAT Traversal must use one or more techniques to accomplish this.
Some techniques involve IPv6, which we don't have good support for in VB6. Another is to manually configure port mapping via the router's admin interface. Another uses Windows libraries to access the UPnP interface of routers to perform a port mapping from the Public IP address to a client with a Private address. Still others involve "hole punching" techniques, and these don't work for every router so some software has several of them implemented and tries them in turn until one succeeds.
UPnP is the most viable for a VB6 program, but it requires that the router supports UPnP and has UPnP enabled. Some routers have this turned off by default, but most have it turned on these days.
Look for NAT UPnP examples in the CodeBank.
Firewall configuration on the PC is also required, of course.
I'm using UPnPNAT/UPnPNATCBs classes to retrieve public IP rather than local/router IP; but I don't know how to utilize it to allow for incoming connections in mswinsck on listening ports. Is there anything particularly built for VB6 to accommodate that? I would like to use UPnP but I'm very, very new to it conceptually.
Originally Posted by CrazyDude
Something else too...If you're trying to connect to yourself through your public IP, the feature is called NAT Loopback, which is different than NAT Traversal. I've had this same problem before and it may be what you're experiencing. Not all routers are configured for it by default and some very old routers don't support it at all. You may want to go into your router's web GUI and see if you can find that setting somewhere.
Here's an old blog post about NAT Loopback:
http://www.networkwebcams.co.uk/blog...-nat-loopback/
I thought you were saying it's possible that my issue stems from connecting from my public IP to my public IP, but I don't think that's the case because I used a web based port scanner and determined that the ports weren't discoverable or accessible.
Code:
[+] Nmap scan report for {my isp info} {my public ip}
Host is up.
PORT STATE SERVICE VERSION
22/tcp filtered ssh
80/tcp filtered http
81/tcp filtered hosts2-ns
443/tcp filtered https
2600/tcp filtered zebrasrv
2601/tcp filtered zebra
8080/tcp filtered http-proxy
Also, I allowed "edge traversal" for the program in Windows Firewall but the same issue persists.
Is there a layman's term solution or code example to accomplish allowing incoming connections to your public IP in VB6 via mswinsck.ocx?
Last edited by backflip; Dec 11th, 2017 at 06:34 AM.
-
Dec 11th, 2017, 07:52 AM
#5
Addicted Member
Re: Can't Telnet to public IP with Winsock client/server program, only localhost work
Ok, yeah, I was going to mention to try an external port scanner (on the web) to see if the port is open. You did that and if it's still not there, then something else is going on. I don't know what parameters you used with nmap for that scan, but I don't think it scans for TCP port 2600 by default. Have you tried targeting just that port instead of a general scan?
It could be that you just don't truly have TCP port 2600 forwarding properly on your router, as dilettante mentioned. I would try bypassing VB6 altogether and trying a well-known app, such as a free FTP server, etc. and get that working first.
Last edited by CrazyDude; Dec 11th, 2017 at 08:09 AM.
Reason: Misread
-
Dec 11th, 2017, 08:16 AM
#6
Re: Can't Telnet to public IP with Winsock client/server program, only localhost work
Maybe see Easy UPnP NAT Traversal if you haven't already.
That version maps a UDP port from the Public IP to a local machine's Private IP port. Then it will "ping" itself on the Public IP address.
With TCP you would need two Winsock controls to do this. One would Bind to the local Private IP and port, the other would Connect to the Public IP and port.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|