PureBasic 6.20 is out !

Developed or developing a new product in PureBasic? Tell the world about it.
Fred
Administrator
Administrator
Posts: 18153
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: PureBasic 6.20 beta 1 is out !

Post by Fred »

The library used is LibreSSL. TLS server example:

Code: Select all

EnableExplicit
Define.i Con, Timeout, Length
Define Receive$, Key$, Cert$, ClientID
Define *Buffer

Key$ = "-----BEGIN PRIVATE KEY-----"+#LF$+
       "MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAPEbSQq/uwESZduPtDd83qXXkSPf6lUNa17xhM2fOZQxGr0Fdmvw6IsC+QGX25EE1TG6TFQkHlM2rW8y6a3WEC/WzCNWaTCPYD/rguiAFG+4eQmwHjiJFVec0InjjSG9SX8xwS/gQeWdQniKROO4DmMJO8N7mdUhdHODSntXdr9zAgMBAAECgYAE+VMgbaQl+YMwbF6DZogRU8kivFPRPV2hr8nVlBtT+09Z5uryfx3NAFqytbdJ3penVviMI9KcVNxvFtXLSEc9KyjzgysorAfUpwFuECCLDbOXX0HlV6rgkqJdhyV6FybcDLvgcvulHQ64QdYRhW+jPx7vXk3h0/JRFqKQJsY7QQJBAPrDLJRPbAw+Mlq1fHBWk8Z1Qn1ivPAmz+2nPAgDya/xdAlb9GbFAMzCS3upIBpxW70uLI04OuTVhwYL194I5C0CQQD2JHtHp25SkIDpBgZGicEC7yAIE/wPC0P9X85UJqXx5dPx4HbEc8lqSKMbCzkbHyvjHonSHu00QxU1W6ZALFYfAkBcPWzphSl+e2Z0XWvPutkS2FFD5A0R3YUAq1J2tEX9NTj0tGF7aB36M8ImU7jeYTJYrWJv8+4d/Ll1LOgT4XtlAkAxofOV5EYTsf28fzF+wcJAtDUyS81Uv0HLcqkpQM3PdDeDm253eJ2Rp+nzxxSRynxQBNVnoELWefxp0Pw6DnajAkBF5h7fQIbwAEPrhDzhjMXU7g9k9KzkkJN/bluLbleqkkAz1kfkGtWXJdGITZuY4K/X2yp1diWQ0utZjmOmhWsl"+#LF$+
       "-----END PRIVATE KEY-----"

Cert$ = "-----BEGIN CERTIFICATE-----"+#LF$+
        "MIICnTCCAgYCCQD0AWy2vzfcpzANBgkqhkiG9w0BAQUFADCBkjELMAkGA1UEBhMCVVMxDjAMBgNVBAgTBVN0YXRlMQ0wCwYDVQQHEwRDaXR5MRUwEwYDVQQKEwxPcmdhbml6YXRpb24xHDAaBgNVBAsTE09yZ2FuaXphdGlvbmFsIFVuaXQxLzAtBgNVBAMTJkNvbW1vbiBOYW1lIChlLmcuLCB5b3VyIHNlcnZlciBkb21haW4pMB4XDTI0MTEwNjE2NTI1N1oXDTI0MTIwNjE2NTI1N1owgZIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIEwVTdGF0ZTENMAsGA1UEBxMEQ2l0eTEVMBMGA1UEChMMT3JnYW5pemF0aW9uMRwwGgYDVQQLExNPcmdhbml6YXRpb25hbCBVbml0MS8wLQYDVQQDEyZDb21tb24gTmFtZSAoZS5nLiwgeW91ciBzZXJ2ZXIgZG9tYWluKTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA8RtJCr+7ARJl24+0N3zepdeRI9/qVQ1rXvGEzZ85lDEavQV2a/DoiwL5AZfbkQTVMbpMVCQeUzatbzLprdYQL9bMI1ZpMI9gP+uC6IAUb7h5CbAeOIkVV5zQieONIb1JfzHBL+BB5Z1CeIpE47gOYwk7w3uZ1SF0c4NKe1d2v3MCAwEAATANBgkqhkiG9w0BAQUFAAOBgQCprm5a5bg1LqCDdtwDTnRDmVcca6HoUlvbjZLmWdLjltG1McNAATppTy/bF7vT3jXLobA1Vzs2g14POjYQhPnIbRPEnNzvAe+Se3y0YeFOwYarEyFBHKHODGIPaCnXGH8gB9fgcp2SYtLaPKvXdNL44VeYGbD4+fvUcu/zkXqTSg=="+#LF$+
        "-----END CERTIFICATE-----"

UseNetworkTLS(Key$, Cert$)
Con = CreateNetworkServer(#PB_Any, 20252, #PB_Network_TCP | #PB_Network_IPv4 | #PB_Network_TLSv1_3)
*Buffer = AllocateMemory(1000)

If Con
  Timeout = 10000
  
    Repeat
      Select NetworkServerEvent()
        Case #PB_NetworkEvent_Data
          
          Debug "Data !"
          ClientID = EventClient()
          PokeA(*Buffer, 0)
          Debug ReceiveNetworkData(ClientID, *Buffer, 1000)
          
          Debug "String: "+PeekS(*Buffer, -1, #PB_UTF8)
          SendNetworkString(ClientID, "Well received !!!")
          
        Case #PB_NetworkEvent_None
          Delay(200)
          Timeout - 1
      EndSelect
          
    Until Timeout = 0
    
    CloseNetworkServer(Con)
  Else
    Debug "Can't create the server"
EndIf
And the associated client:

Code: Select all

Define.i Con, Timeout, Length
Define Receive$
Define *Buffer
  
  
UseNetworkTLS()

Con = OpenNetworkConnection("127.0.0.1", 20252, #PB_Network_TCP | #PB_Network_IPv4 | #PB_Network_TLSv1_3)
If Con
  *Buffer = AllocateMemory($FFFF, #PB_Memory_NoClear)
  If *Buffer
    Debug "Sending string"
    SendNetworkString(Con, "GET / HTTP/1.1" + #CRLF$ + "Host: www.purebasic.fr" + #CRLF$ + #CRLF$)
    Debug "String Sent"
    Timeout = 100
    Repeat
      Select NetworkServerEvent()
          
      EndSelect
      
      Select NetworkClientEvent(Con)
        Case #PB_NetworkEvent_Data
          Repeat
            Length = ReceiveNetworkData(Con, *Buffer, MemorySize(*Buffer))
            If Length > 0
              Receive$ + PeekS(*Buffer, Length, #PB_UTF8 | #PB_ByteLength)
            EndIf
          Until Length = 0 Or (Length > 0 And Length <> MemorySize(*Buffer))
          Break
          
        Case #PB_NetworkEvent_Disconnect
          Debug "Disconnect"
          Break
          
        Case #PB_NetworkEvent_None
          Delay(10)
          Timeout - 1
          
      EndSelect
    Until Timeout = 0
    Debug Timeout
    
    If Receive$ <> ""
      Debug Receive$
    EndIf
    
    FreeMemory(*Buffer)
  EndIf
  
  CloseNetworkConnection(Con)
Else
  Debug "can't create the client"
EndIf


Cyllceaux
Enthusiast
Enthusiast
Posts: 510
Joined: Mon Jun 23, 2014 1:18 pm

Re: PureBasic 6.20 beta 1 is out !

Post by Cyllceaux »

On my Windows 11 24H2

error: could not open 'ucrt.lib': no such file or directory

:(
User avatar
HeX0R
Addict
Addict
Posts: 1187
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: PureBasic 6.20 beta 1 is out !

Post by HeX0R »

Aah, UseNetworkTLS() is the magical trick!
I was wondering yesterday, why my code didn't run, that explains it now.

Thanks for all the new stuff, much appreciated.
Guess I have to buy a license for my 11 year old daughter, you never know :mrgreen:
User avatar
idle
Always Here
Always Here
Posts: 5834
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: PureBasic 6.20 beta 1 is out !

Post by idle »

HeX0R wrote: Thu Dec 12, 2024 10:04 am Aah, UseNetworkTLS() is the magical trick!
I was wondering yesterday, why my code didn't run, that explains it now.

Thanks for all the new stuff, much appreciated.
Guess I have to buy a license for my 11 year old daughter, you never know :mrgreen:
I didn't see that, hopefully it works with multiple certs for reverse proxy support.
User avatar
luis
Addict
Addict
Posts: 3893
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: PureBasic 6.20 beta 1 is out !

Post by luis »

Thanks for the additions.
I guess a purelibrary is only for flat PB-like functions, you can't complie a module as a library right ?
"Have you tried turning it off and on again ?"
A little PureBasic review
User avatar
HeX0R
Addict
Addict
Posts: 1187
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: PureBasic 6.20 beta 1 is out !

Post by HeX0R »

idle wrote: Thu Dec 12, 2024 11:24 am I didn't see that, hopefully it works with multiple certs for reverse proxy support.
Good question, don't think so.
@Fred:
I think a compiler warning is needed, when you use one of the #PB_Network_TLS constants but forgot to use UseNetworkTLS(), because I was irritated, that the connection simply failed.
dige
Addict
Addict
Posts: 1391
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: PureBasic 6.20 beta 1 is out !

Post by dige »

Great news! Thank you Fred and the team for this update!

And as a side note: nice to read that so many from the forum have contributed to it
"Daddy, I'll run faster, then it is not so far..."
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Re: PureBasic 6.20 beta 1 is out !

Post by Psychophanta »

waw!, Thank you very much for this delivery with special attention to Engine3D. For me it is worth savoring, even it is still beta :)
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
mikejs
Enthusiast
Enthusiast
Posts: 175
Joined: Thu Oct 21, 2010 9:46 pm

Re: PureBasic 6.20 beta 1 is out !

Post by mikejs »

Hi all,

Nice to see Windows arm64 support appear!

Is there any prospect of cross-compilation support for this, in either direction (i.e. building arm64 binaries from an x64 platform, or x64 binaries from an arm64 platform)?

i.e. any way to have both x64 and arm64 binaries produced from a single build all targets?
Fred
Administrator
Administrator
Posts: 18153
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: PureBasic 6.20 beta 1 is out !

Post by Fred »

No it's not planned for now but it shouldn't be that hard to do.
Fred
Administrator
Administrator
Posts: 18153
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: PureBasic 6.20 beta 1 is out !

Post by Fred »

luis wrote: Thu Dec 12, 2024 12:10 pm Thanks for the additions.
I guess a purelibrary is only for flat PB-like functions, you can't complie a module as a library right ?
Yes it's to create purebasic-like libraries
User avatar
ChrisR
Addict
Addict
Posts: 1466
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: PureBasic 6.20 beta 1 is out !

Post by ChrisR »

Thank you very much for the update and all the new features :)

For Use shared UCRT, the ucrt.lib is missing, I downloaded it with Visual Studio linker download and copied it to \PureLibraries\Windows\Libraries and it seems to work fine. I hope it will be redistributed
However, I thought I'd gain more in size 3.40 Mb vs 3.65 Mb

To download x64 ucrt.lib only:
https://download.microsoft.com/download ... e71928.cab (25,7 Mo)
and extract fil9880b801b7a55120f35d0b81c561ed78 to ucrt.lib (279 Ko)
Fred
Administrator
Administrator
Posts: 18153
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: PureBasic 6.20 beta 1 is out !

Post by Fred »

Yes, it's missing from the package, it will be added for the next beta.
User avatar
skywalk
Addict
Addict
Posts: 4210
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: PureBasic 6.20 beta 1 is out !

Post by skywalk »

Fred wrote: Thu Dec 12, 2024 4:47 pm
luis wrote: Thu Dec 12, 2024 12:10 pm Thanks for the additions.
I guess a purelibrary is only for flat PB-like functions, you can't complie a module as a library right ?
Yes it's to create purebasic-like libraries
This is also why I prefer flat libs for my own code.
The modules are too heavy for my brain.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: PureBasic 6.20 beta 1 is out !

Post by PrincieD »

I'm liking the PureLibrary creation feature! (for obvious reasons :lol:)
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
Post Reply