Search found 41 matches

by Dadido3
Mon Dec 05, 2022 5:42 pm
Forum: Tricks 'n' Tips
Topic: WebSocket Server
Replies: 41
Views: 28546

Re: WebSocket Server

I just added a function to get that data:

Protected *HTTP_Header.WebSocket_Server::HTTP_Header = WebSocket_Server::Get_HTTP_Header(*Client)
PrintN(" Request: " + *HTTP_Header\Request)
ForEach *HTTP_Header\Field()
PrintN(" Header Key-Value pair: " + MapKey(*HTTP_Header\Field()) + #TAB$ + #TAB ...
by Dadido3
Mon Dec 05, 2022 2:49 am
Forum: Tricks 'n' Tips
Topic: WebSocket Server
Replies: 41
Views: 28546

Re: WebSocket Server


However, I'd like to capture the URL which the User connect to


The server stores the parsed HTTP request for every client, so theoretically the information is there. Unfortunately it's only available from inside the library.

But i could add a function that returns the HTTP request for a client ...
by Dadido3
Mon Nov 29, 2021 1:32 pm
Forum: Coding Questions
Topic: Locking a mutex multiple times?
Replies: 10
Views: 2418

Re: Locking a mutex multiple times?

The documentation needs to be updated in this case. It works here too, on Windows 11 x64 with PB 5.72.

But still, in my opinion it's bad practice to use mutexes in that way, as it can produce unreadable code. The result of unreadable code is that you may introduce mistakes, which cause ...
by Dadido3
Mon Nov 29, 2021 12:56 pm
Forum: Coding Questions
Topic: Locking a mutex multiple times?
Replies: 10
Views: 2418

Re: Locking a mutex multiple times?

Hi,

what i would do is to create variants of your functions. So one variant that locks/unlocks the mutex, and one that doesn't. To reduce duplicate code you can make the function that locks/unlocks the mutex a wrapper of the one that doesn't lock/unlock the mutex.

This works especially well, if ...
by Dadido3
Mon Sep 06, 2021 2:16 pm
Forum: Coding Questions
Topic: Duktape JS
Replies: 11
Views: 2021

Re: Duktape JS

Regarding a JSON lib for lua. This one quite fast and small: https://github.com/rxi/json.lua

You just have to figure out how to get it to work with require. Lua has some rules where it searches for files that are "required", so either put that file into the same folder as the script you are calling ...
by Dadido3
Mon Jun 07, 2021 6:31 pm
Forum: Coding Questions
Topic: how can i docking gadgets on windows ?
Replies: 3
Views: 1640

Re: how can i docking gadgets on windows ?

Hey,

i wanted to make a library out of this part of D3hex, and i already started working on a newer docking gadget that is extendable so that it could work on linux and macOS, too. But i haven't got that finished, last time i worked on it was in 2017.

Here is a version i just extracted from D3hex ...
by Dadido3
Fri May 22, 2020 1:51 pm
Forum: Tricks 'n' Tips
Topic: LUA - Script with PureBasic
Replies: 22
Views: 12612

Re: LUA - Script with PureBasic

A change to Lua 5.4 is not planned. But you could generate a diff between the 5.3 and 5.4 header files of lua and then apply those changes to the PureBasic include.

Also, new minor versions in lua mostly mean breaking changes (Not only to the API, but also to the language itself). Some people even ...
by Dadido3
Fri May 22, 2020 9:31 am
Forum: Tricks 'n' Tips
Topic: LUA - Script with PureBasic
Replies: 22
Views: 12612

Re: LUA - Script with PureBasic

Just to clarify it, as it states in the repo:
To make Lua work on Windows you have to copy the according (x86 or x64) shared library (*.dll) into the same folder as your application. The *.dll files can be found in Libraries\Lua\Binaries\Windows\x__\, for Linux no files have to be copied because ...
by Dadido3
Fri Mar 02, 2018 2:47 am
Forum: Tricks 'n' Tips
Topic: WebSocket Server
Replies: 41
Views: 28546

Re: WebSocket Server

Hello bbanelli,

a few points regarding the limits:

The OS limits the amount of connections an application or the complete system can have. I don't know exact numbers right now, but on Windows it's artifically limited so that you have to buy the server version for more sophisticated use of ...
by Dadido3
Wed Feb 28, 2018 8:15 pm
Forum: Tricks 'n' Tips
Topic: WebSocket Server
Replies: 41
Views: 28546

Re: WebSocket Server

I have tried to reproduce that bug, but i wasn't able to do so on Windows or Linux, even with over 100 clients. But while looking over the code i found a possible deadlock case which i fixed. (Double locking of a mutex from the same context)
There were also some other small things which i fixed and ...
by Dadido3
Fri Feb 16, 2018 12:12 pm
Forum: General Discussion
Topic: Question about UCS2
Replies: 3
Views: 1780

Re: Question about UCS2

On windows the strings are interpreted as UTF-16, which is like an extension of UCS-2. That means that a pair of special codepoints is used to represent characters above 65536.
These codepoints are contained in the unicode codepage anyway, so the only difference between UCS-2 and UTF-16 is that the ...
by Dadido3
Tue Nov 14, 2017 1:05 am
Forum: Coding Questions
Topic: Binding Lua 5.3.4 to PureBasic 5.51 Application (x64)
Replies: 3
Views: 1904

Re: Binding Lua 5.3.4 to PureBasic 5.51 Application (x64)

Hello,

you are trying to link a static library for linux (liblua53.a) on windows, that's why you get the error. The correct way would be to use the dll and the lua53.lib for windows, and link it dynamically. Theoretically you can link it statically too; I tried but i didn't got the lib from the ...
by Dadido3
Fri Aug 11, 2017 2:11 pm
Forum: Applications - Feedback and Discussion
Topic: D3hexeditor
Replies: 19
Views: 17004

Re: D3hexeditor

I still work on it, but i haven't progressed much in the last few months.

My plan until version 1.00 consists mostly of usability fixes (And also some features). There are a lot of small but annoying little things which have to be fixed. Like inconsistencies in how you enter numbers for example ...
by Dadido3
Fri May 19, 2017 11:44 pm
Forum: Tricks 'n' Tips
Topic: WebSocket Server
Replies: 41
Views: 28546

Re: WebSocket Server

Hi morosh,

replace Base64Encoder with Base64EncoderBuffer. Or just redownload, as i have updated the include.
by Dadido3
Tue Jan 31, 2017 12:57 am
Forum: Coding Questions
Topic: LUA ~ how can i verify if functions , var or table exists ?
Replies: 5
Views: 1759

Re: LUA ~ how can i verify if functions , var or table exist

Hi,

just use lua_pcall instead of lua_call.
I even gave you a full example in an earlier post: http://www.purebasic.fr/english/viewtop ... 76#p499376