Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
_OPENHOST to port 443 fails
#1
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
Reply
#2
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.
Reply
#3
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
Reply
#4
(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?
Reply
#5
(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]
Reply
#6
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]
Reply
#7
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
Reply
#8
(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!
Reply
#9
One of those brave ones, eh? Welcome to the forums! Cool
Reply
#10
Isn't 443 for HTTPS?
Tread on those who tread on you

Reply




Users browsing this thread: 7 Guest(s)