Recent

Author Topic: TCP read compleate string problem  (Read 816 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 1998
    • Lazarus and Free Pascal italian community
TCP read compleate string problem
« on: March 11, 2019, 08:34:46 am »
Hi guys, I want to create an encrypted tunnel with the use of asymmetric keys for my database connections. Proceeding by step, I came across a first problem. That is to create a stable non-encrypted tunnel. Simplifying it even more I just did a program that reads the data coming from the client and sends them to the database server, waits for the response of the database server and returns it to the client. Here I meet the first problem. Sometimes it works and sometimes it does not. As if I did not correctly manage the buffer reading (I've already tried different ways). I attach my source.
If unzip the attached file you find the console program that acts as an intermediary, you have to go and put the ip address and password of your database. Inside the attachment there is the client folder where inside there is a program with three buttons, one makes the connection, the other the disconnection and the third performs a select with ten records. When I run the query every once in a while it works and sometimes it does not. Who explains where I'm wrong? Obviously in the program with the three buttons you have to go to put the username, password and protocol to access your database. Thank you very much to anyone who wants to help me.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

xinyiman

  • Hero Member
  • *****
  • Posts: 1998
    • Lazarus and Free Pascal italian community
Re: TCP read compleate string problem
« Reply #1 on: March 11, 2019, 09:03:13 am »
Only 2 points:

into client zconnection object replace localhost with 127.0.0.1 and change database name with your database.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

xinyiman

  • Hero Member
  • *****
  • Posts: 1998
    • Lazarus and Free Pascal italian community
Re: TCP read compleate string problem
« Reply #2 on: March 11, 2019, 04:14:45 pm »
no suggestion?
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1