Page 1 of 1 1
Topic Options
#213289 - 2018-05-12 02:40 PM How to use sockets
AndreLuiz Offline
Getting the hang of it

Registered: 2015-10-07
Posts: 89
Loc: Brasil, João pessoa
[PTBR]
Queria que alguém por favor me dê uma ajuda sobre o Socket!!
Eu quero criar uma aplicação em uma maquina "A", que vai enviar informações para a maquina "B".

E não sei nada de socket, por favor me peço uma ajuda sobre isso, é muito importante!!
E outra, eu posso fazer teste na mesma maquina em quanto o meu server não fica pronto?
desde já agradeço!!

[ENG]
I wanted someone to please give me a help on Socket !!
I want to create an application on an "A" machine, which will send information to machine "B".

And I do not know anything about socket, please ask me for a help on this, it's very important !!
And another, can I test on the same machine when my server is not ready?
Thank you very much in advance!!

Top
#213290 - 2018-05-14 11:42 AM Re: How to use sockets [Re: AndreLuiz]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 686
Loc: Maryland, USA
I'm not sure socket is truly what you want to use here. Please tell us what you are trying to accomplish. We may come up with a better plan.
Top
#213472 - 2018-06-28 11:29 PM Re: How to use sockets [Re: BradV]
AndreLuiz Offline
Getting the hang of it

Registered: 2015-10-07
Posts: 89
Loc: Brasil, João pessoa
[PtBr]
Me desculpe por não ter respondido antes, na verdade isso era para me ajudar, mas mesmo assim não tive tempo de vir aqui, ai agora tive tempo e estou aqui, enfim.

Eu quero usar socket pra trocar informações entre duas aplicações kix.

E na verdade tenho uma pergunta se eu colocasse um app feito para socket em um servidor na China, eu conseguiria buscar os dados facilmente por um aplicação kix no Brasil? 'kkk
Desculpe-me, é que não tenho noção de como isso funciona sabe, por isso estou lhe perguntando isso de forma estupida 'kkkk

[ENG]
Sorry for not responding before, actually, it was to help me, but even then I did not have time to come here, now I had time and I'm here, anyway.

You use the socket to exchange information between two kix applications.

And, in fact, a question that poses to a request for a socket on a server in China, can I get the data through a kix application in Brazil? lol
Excuse me, I do not have the notion of how this works, so I'm asking you stupidly 'kkkk

Top
#213474 - 2018-06-29 02:05 PM Re: How to use sockets [Re: AndreLuiz]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 686
Loc: Maryland, USA
No, what I meant was tell us what you are trying to accomplish in general, not the specific. I know what a socket is. My point is that solution may not be the best approach. It might be simpler to just transfer a file or something else. Describe the overall task you are trying to accomplish.
Top
#213482 - 2018-07-02 06:56 PM Re: How to use sockets [Re: BradV]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Andre, so... it is possible with a socket, but transferring data is possible by other means as well.

if you are transferring over VPN, then easiest would be to just move text files around. if you are transferring over the plain internet, you might want to look at secure sockets...

easiest for kix might be something like winscp automation: https://winscp.net/download/WinSCP-5.13.3-Automation.zip

why me and Brad are wanting to know what you want is that doing sockets and encryption are both cumbersome in kixtart. knowing what you need, would provide the information for further assistance.
_________________________
!

download KiXnet

Top
#213500 - 2018-07-05 03:52 PM Re: How to use sockets [Re: Lonkero]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Not only do you need to consider encryption, but authorization as well.

I developed a help-desk app using Kixforms and Sockets. A small Kix script ran on the workstations as a system service. It listened for connections and performed queries/tasks. For queries, it collected data and returned it to the manager application in the help desk.

It starts by exchanging a series of packets to negotiate an authentication. In this "clear text" exchange, a clear value and a hashed value are passed, calcuation performed, and a hash returned. When the calculations on each end match the hashes exchanged, communication can start. The data that is exchanged from that point forward is obfuscated via my cipher function. The initial release did not encode the request/response data as it was used exclusively on a private network.

Another challenge to overcome is exchanging complex data structures. Some of the functions that ran on the target systems returned arrays, or even arrays of arrays. I had to come up with a method to represent this in a data stream and convert it back to the proper format.

It worked well, but it took a lot of time and effort to make it work securely, even without SSL.

Another method to consider is HTML, as you can use Kix to send GET, POST, PUT, and DELETE requests to a URL. A fairly basic ASP or ASP.NET page can pass requests to a Kix application on the back-end. I'm using Kix to integrate with REST APIs on a couple of different platforms now.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#213502 - 2018-07-05 09:30 PM Re: How to use sockets [Re: Glenn Barnas]
AndreLuiz Offline
Getting the hang of it

Registered: 2015-10-07
Posts: 89
Loc: Brasil, João pessoa
[PtBr]
Antes de mais nada peço obrigado a todos que estão dedicando tempo para me ajudar nesse meu problema.

Bom, imaginem que vocês estão explicando sockets para uma criança, pronto, faça isso comigo hahah.

Na verdade não estou conseguindo compreender. Sobre o meu código, não existe nada ainda!
Mas serial algo do tipo:
É tipo assim, o meu programa(server) vai abrir um arquivi ".ini", e depois o meu outro programa(cliente), vai pegar as informações desse ".ini", atráves do programa(server).

Antecipando algumas perguntas/questões óbvias que pode surgir:
1. Eu sei que posso fazer isso diretamente sem precisar de um programa(server).
2. Não tenho código ainda.
3. É uma aplicação LocalHost.
4. Eu já pensei em três maneiras de fazer isso, mas não estou interessado nessas.

Se caso de forma alguma for possíveel de um exemplo simples de como usar o sockets, então por favor me de exemplo em código de outras maneiras boas de como fazer oque quero.

Obrigado desde já!

[ENG]
First of all, I thank everyone who is taking the time to help me with my problem.

Well, imagine, you're covering a child's orbits, all right, do this to me hahah.

I can not really understand. About my code, there is nothing yet!
But serial something like:
So, my program will open a ".ini" file, and then my other program (client), will get the information like ".ini", through the program (server).

Anticipating some obvious questions / issues that may arise:
1. I know I can do the same thing without needing a program (server).
2. I do not have code yet.
3. It is a LocalHost application.
4. I've already thought of three ways to do this, but it's not me.

If any way to use a simple example of how to use the sockets, then please use an error code as a good way to do what I want.

Thanks in advance!

Top
#213510 - 2018-07-06 02:41 PM Re: How to use sockets [Re: AndreLuiz]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Andre

I've attached the original Sockets demo code - it's a very simple example of how to open a socket connection, how to set up a listener, etc.. It does NOT have any security or authentication, which you would have to write as part of your app.

Glenn


Attachments
sosckets.zip (865 downloads)
Description:


_________________________
Actually I am a Rocket Scientist! \:D

Top
#213511 - 2018-07-06 02:42 PM Re: How to use sockets [Re: Glenn Barnas]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
I just noticed that it's spelled incorrectly, but this is how I received it from Shawn - this might explain why it's so hard to find!

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#213512 - 2018-07-06 05:12 PM Re: How to use sockets [Re: Glenn Barnas]
AndreLuiz Offline
Getting the hang of it

Registered: 2015-10-07
Posts: 89
Loc: Brasil, João pessoa
[PtBr]
Pela primeira vez fiz isso funcionar. E ai para aprender já montei um script simples.
Muito obrigado Glen!

Ah sobre a parte de criptografica eu desenvolvi uma udf que gera um código diferente a cada rodada para a mesma sequência de caractere, e isso para cada caractere. ex:
 Quote:

str : Andre
cry1 : 6240964272606642670067429120804292929242
Dcry1 : Andre
--------------
cry2 : 89701384395708742800080429804864296969642
Dcry2 : Andre

Só um pouco grande a sequência, mas funciona muito bem! depois eu ditribuo, estou muito atarefado ultimamente.

Obrigado gente! mas se tiverem outras maneiras que vocês acham que é melhor, eu adoraria saber, mas se for falar de outras maneiras, postem um simples código de como funciona. É porque a maior ponte entre nós, é os códigos, porque você falam uma língua diferente da minha, vocês falam em inglês e eu em português[Brasil], e quando vocês falam com código faz muito mais sentido para mim!

Até porque o "google translator" não traduz tudo perfeitamente.
Muito obrigado por tudo gente!


[ENG]
For the first time I made it work. And then to learn I've already assembled a simple script.
Many thanks Glen!

Ah over the cryptographic part I've developed a udf that generates a different code every round for the same character string, and this for each character. ex:
 Quote:
str: Andre
cry1: 6240964272606642670067429120804292929242
Dcry1: Andre
--------------
cry2: 89701384395708742800080429804864296969642
Dcry2: Andre

Just a little big the sequence, but it works great! then I've been very busy lately.


Thank you guys! but if you have other ways that you think is best, I'd love to know, but if you're going to talk in other ways, post a simple code on how it works. It's because the biggest bridge between us, it's the codes, because you speak a language different from mine, you speak English and I speak Portuguese, and when you talk with code it makes a lot more sense to me!

Even because "google translator" does not translate everything perfectly.
Thank you so much for everyone!

Top
#214220 - 2023-04-21 02:54 AM Re: How to use sockets [Re: AndreLuiz]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
It's been a long time, and I'm not a fan of necro-ing a post, but I wanted to share an idea for this.

We had to pass some complex data structures to workstations around the world, quickly and reliably. On the server side, a Kix app "packages" 15 distinct INI files, plus a set of variable data (including arrays). We use ASCII control codes to define the start of a data block (SOM), then split the file name and checksum from the actual file data, which is read until an EOM identifies the end of the file. This repeats until all 15 files are in a data stream. The variables are sent via name-value pairs, and array elements are delimited with other control codes. The entire data stream is ciphered with my Cipher() function. This takes about a second to complete. The entire data stream is downloaded over an https connection, deciphered, and split into the individual files written to disk, and the vars are loaded into memory. That process takes under 2 seconds, compared to the prior method of requesting one file at a time, which took 18-20 seconds.
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


Moderator:  ShaneEP, Mart, Radimus, Jochen, Allen, Glenn Barnas 
Hop to:
Shout Box

Who's Online
0 registered and 370 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.063 seconds in which 0.025 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org