TcpLinkClient port 443 instead of 80, not working?

Hi,

Could you please tell me why the code below does not work (the requested web content does not return) if the port is changed to 443 - for https connection? (please see the last line: TargetPort=80).
(code downloaded from here https://api.unrealengine.com/udk/Thr…html#Downloads).

(the web content does not return).

Thanks.



/*
 * An example usage of the TcpLink class
 *  
 * By Michiel 'elmuerte' Hendriks for Epic Games, Inc.
 *  
 * You are free to use this example as you see fit, as long as you
 * properly attribute the origin.
 */
class TcpLinkClient extends TcpLink;

var string TargetHost;
var int TargetPort;

event PostBeginPlay()
{
    super.PostBeginPlay();
    // Start by resolving the hostname to an IP so we can connect to it
    // Note: the TcpLink modes have been set in the defaultproperties
    `Log("[TcpLinkClient] Resolving: "$TargetHost);
    resolve(TargetHost);
}

event Resolved( IpAddr Addr )
{
    // The hostname was resolved succefully
    `Log("[TcpLinkClient] "$TargetHost$" resolved to "$ IpAddrToString(Addr));

    // Make sure the correct remote port is set, resolving doesn't set
    // the port value of the IpAddr structure
    Addr.Port = TargetPort;

    `Log("[TcpLinkClient] Bound to port: "$ BindPort() );
    if (!Open(Addr))
    {
        `Log("[TcpLinkClient] Open failed");
    }
}

event ResolveFailed()
{
    `Log("[TcpLinkClient] Unable to resolve "$TargetHost);
    // You could retry resolving here if you have an alternative
    // remote host.
}

event Opened()
{
    // A connection was established
    `Log("[TcpLinkClient] event opened");
    `Log("[TcpLinkClient] Sending simple HTTP query");

    // The HTTP request
    SendText("GET / HTTP/1.0"$chr(13)$chr(10));
    SendText("Host: "$TargetHost$chr(13)$chr(10));
    SendText("Connection: Close"$chr(13)$chr(10));
    SendText(chr(13)$chr(10));

    `Log("[TcpLinkClient] end HTTP query");
}

event Closed()
{
    // In this case the remote client should have automatically closed
    // the connection, because we requested it in the HTTP request.
    `Log("[TcpLinkClient] event closed");

    // After the connection was closed we could establish a new
    // connection using the same TcpLink instance.
}

event ReceivedText( string Text )
{
    // receiving some text, note that the text includes line breaks
    `Log("[TcpLinkClient] ReceivedText:: "$Text);
}

defaultproperties
{
    TargetHost="www.google.com"
    TargetPort=80    //does not work if changed to 443??? (www.google.com:443 works normally).
}



“does not work” means the requested web content (www.google.com) does not return.

[http://i1289.photobucket.com/albums/...pszhyrsav3.png

](http://i1289.photobucket.com/albums/b517/9454/2018-04-23_17h49_23_zpszhyrsav3.png)

That is because google.com does not return anything if the http request is wrong.
If I try to connect to another site: amazon.com, the server returns useful information:

[0139.68] ScriptLog: [TcpLinkClient] Resolving: amazon.com
[0139.72] ScriptLog: [TcpLinkClient] amazon.com resolved to 176.32.98.166:443
[0139.72] ScriptLog: [TcpLinkClient] Bound to port: 59086
[0139.73] Log: CheckConnectionAttempt: Connection attempt has not yet completed.
[0139.97] Log: CheckConnectionAttempt: Connection attempt has not yet completed.
[0139.98] ScriptLog: [TcpLinkClient] event opened
[0139.98] ScriptLog: [TcpLinkClient] Sending simple HTTP query 176.32.98.166:443
[0139.98] ScriptLog: [TcpLinkClient] end HTTP query
[0140.47] ScriptLog: [TcpLinkClient] ReceivedText:: HTTP/1.1 400 Bad Request
Server: Server
Date: Tue, 24 Apr 2018 01:03:43 GMT
Content-Type: text/html
Content-Length: 265
Connection: close

<html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
<hr><center>Server</center>
</body>
</html>

[0140.47] ScriptLog: [TcpLinkClient] event closed

It says “400 The plain HTTP request was sent to HTTPS port”.
So I need to figure out how to send the correct https requests…

I used this tutorial as a guide and didn’t have any trouble Tcplink: Talking to an Online Database

Thanks for the link. In that tutorial, he uses port 80 (http).
My issue is with port 443 (https).

Seems I didn’t understand the question at all actually.
This seems like a question for web developer forums (how a HTTPS request should look like written down) since on the Unrealscript side you just provide a text string.