#213289 - 2018-05-12 02:40 PM
How to use sockets
|
AndreLuiz
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
|
|
|
|
#213472 - 2018-06-28 11:29 PM
Re: How to use sockets
[Re: BradV]
|
AndreLuiz
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
|
|
|
|
#213500 - 2018-07-05 03:52 PM
Re: How to use sockets
[Re: Lonkero]
|
Glenn Barnas
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!
|
Top
|
|
|
|
#213502 - 2018-07-05 09:30 PM
Re: How to use sockets
[Re: Glenn Barnas]
|
AndreLuiz
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
|
|
|
|
#213512 - 2018-07-06 05:12 PM
Re: How to use sockets
[Re: Glenn Barnas]
|
AndreLuiz
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:
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:
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
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!
|
Top
|
|
|
|
Moderator: ShaneEP, Mart, Radimus, Jochen, Allen, Glenn Barnas
|
1 registered
(mole)
and 405 anonymous users online.
|
|
|