QB64 Phoenix Edition
_OPENHOST to port 443 fails - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10)
+---- Thread: _OPENHOST to port 443 fails (/showthread.php?tid=1397)



_OPENHOST to port 443 fails - jleger2023 - 01-14-2023

Hey all,

This is my first post here. I'm tinkering with QB64 to create a simple server. Listening on port 80 or port 8080 works just fine, but when I try to listen on port 443 it always returns 0 (fail). I've added port access to the Windows firewall and even tried disabling the firewall completely in case I'd done something wrong, but it still fails.

Here's my code. Any ideas? Thanks in advance.

Code: (Select All)
Dim socketHost As Integer
Dim socketClients(1000) As Integer
Dim clientIndex As Integer
Dim socketClient As Integer
Dim socketData As String

socketHost = _OpenHost("TCP/IP:443")

If socketHost Then
    Print "LISTENING @ " + _ConnectionAddress(socketHost)
    Do
        socketClient = _OpenConnection(socketHost)
        If socketClient Then
            socketClients(clientIndex) = socketClient
            clientIndex = clientIndex + 1
        End If

        For i = 0 To clientIndex - 1
            Get #socketClients(clientIndex), , socketData
            Print socketData
        Next
    Loop

    Close #socketHost
Else
    Print "Failed to open socket to port 443."
End If



RE: _OPENHOST to port 443 fails - jleger2023 - 01-14-2023

Never mind, I figured it out. Apparently I have to specify the port as 0443 and not just 443. When I did that, it works.


RE: _OPENHOST to port 443 fails - TerryRitchie - 01-14-2023

It's been a while since I played around with networking but I would check these:

- ISP may be blocking 443 (your router behind another router)
- Port forwarding
- Firewall (Check those firewall settings again)
- Possibly need to set up a NAT rule (unlikely but something to look into)
- Some other application/service running is using 443


RE: _OPENHOST to port 443 fails - TerryRitchie - 01-14-2023

(01-14-2023, 03:47 AM)jleger2023 Wrote: Never mind, I figured it out. Apparently I have to specify the port as 0443 and not just 443. When I did that, it works.

Seriously? Did you need to specify 80 as 0080?


RE: _OPENHOST to port 443 fails - jleger2023 - 01-14-2023

(01-14-2023, 03:49 AM)TerryRitchie Wrote:
(01-14-2023, 03:47 AM)jleger2023 Wrote: Never mind, I figured it out. Apparently I have to specify the port as 0443 and not just 443. When I did that, it works.

Seriously? Did you need to specify 80 as 0080?

No, I didn't. I'm scratching my head over it but using 0443 works and _ConnectionAddress returns "TCP/IP:443:[my ip]" so it's clearly using port 443.

[added]Ok, now 443 is working again. Something must have made Windows think the port was already opened and using 0443 cleared that out so now it works. Weird.[/added]


RE: _OPENHOST to port 443 fails - jleger2023 - 01-14-2023

The next issue I'm working on is that a WebSocket opened to my IP from javascript in an HTML page doesn't show up as a connection in the QB64 program. What I'm trying to achieve is a lightweight Nostr protocol node/server written in QB64.

[added]It works fine when I use wss://localhost or wss://127.0.0.1 but when I use wss://[my public ip] it fails. I have port 443 open in and out in the firewall.[/added]


RE: _OPENHOST to port 443 fails - SMcNeill - 01-14-2023

You may need to enable port forwarding in your router, so the public ip knows which device to send the info to for you.  Smile


RE: _OPENHOST to port 443 fails - jleger2023 - 01-14-2023

(01-14-2023, 05:25 AM)SMcNeill Wrote: You may need to enable port forwarding in your router, so the public ip knows which device to send the info to for you.  Smile

Thanks for that. I'll give it a try!


RE: _OPENHOST to port 443 fails - mnrvovrfc - 01-14-2023

One of those brave ones, eh? Welcome to the forums! Cool


RE: _OPENHOST to port 443 fails - SpriggsySpriggs - 01-19-2023

Isn't 443 for HTTPS?