Home   Archive   Permalink

Unique PC ID

How can I generate an ID for a specific PC?
Now I do this:
if not exists? %id.txt [
    write %id.txt trim/all random rejoin [now speed? system/network/host-address]
id: read %id.txt
but I would like to get away from working with files.
I tried something like:
>> rejoin [system/user/name system/user/email system/network/host system/network/host-address]
== "A RebolnoneUser-PC192.168.56.1"
but this is suitable for one, local network. And when you work with a server on the Internet, you end up with many identical identifiers from different PCs.
Tried to request a MAC address:
mac: copy ""
call/output "getmac /v /fo csv" mac
and disk serial number:
sn: copy ""
call/output "wmic diskdrive get SerialNumber" sn
but this only works as an administrator in windows. When launched as a simple user, Rebol freezes.
Perhaps someone has already solved this problem or can offer a source of consistently unique PC identification.

posted by:   Sergey_Vl     6-May-2024/19:29:55-7:00

I haven't had to do this, but if you're identifying machines on a network, why not generate and store unique autoincremented IDs in a single list on a server that's accessible by all other machines? Each client could then just request their own identifier - and that identifier doesn't need to be tied to any specific information, or meaningful in any other way - it's just a numbered ID which is doled out by the server. Whenever each machine needs to interact with the server, or any other machine, it can identify itself with the unique ID that's been assigned by the server.

posted by:   Nick     10-May-2024/13:20:39-7:00

Of course, if you need to store other information about each machine, any number of columns of values can be related to the unique ID, and stored in the server DB.

posted by:   Nick     10-May-2024/13:22:48-7:00

Perhaps if I describe why I need this, the purpose will become a little clearer.
I wrote a small gateway and function for requests to AI from Rebol:
>>ai: func [request] [ read/custom http://pochinoksergey.ru/rebol/ai/2/ reduce ['post append "q=" request]]
>>ai "do you speak in engl"
connecting to: pochinoksergey.ru
== {Hihi, I can answer your question in English if you prefer.}
To identify the context of a specific program instance, I want to try to get that same unique PC number. After all, several users can simultaneously conduct “dialogues” and if one talks about water and the other about lead, then when a request is received, the “boiling point” for lead mast be not 100 degrees, and for water not 1700. This ID will be inserted into the request, like “conversation on the topic number #id” and then the AI will have a lot different of context within one global conversation session.
Because The program may be launched from a read-only device, such as a CD-ROM or from a web server, then writing to the file may not work. Saving data to temporary folders in RAM restores the context during restarts.
P.S. How can I remove the printing of the line "connecting to: pochinoksergey.ru"?

posted by:   Sergey_Vl     12-May-2024/6:59:08-7:00

... forgot to insert the word 'copy'. I keep getting caught in this :)
ai: func [request] [ return read/custom http://pochinoksergey.ru/rebol/ai/2/ reduce ['post append copy "q=" request]]

posted by:   Sergey_Vl     12-May-2024/7:25:08-7:00



Type the reverse of this captcha text: "s e r i p x E"