Recent

Author Topic: LNET  (Read 6549 times)

rajivsoft

  • New Member
  • *
  • Posts: 48
LNET
« on: October 04, 2011, 05:17:41 pm »
I have an issue with LNET client tcp socket.I am using lazarus on MAC.I have an application that runs on startup,and connect to a server.On some computer in which ethernet net card take time to become active and connect to public network, my client application not able to connect to server.The connect get fails obviously with the network card is not up.once up still connect fails.Not able to understand why...

Any help will be appreciated.

Rajiv

ik

  • Jr. Member
  • **
  • Posts: 88
  • ik
    • LINESIP
Re: LNET
« Reply #1 on: October 04, 2011, 09:18:15 pm »
Can you please provide the full error code and error message you get back from the attempt (before and after the device is up) ?

Shebuka

  • Sr. Member
  • ****
  • Posts: 429
Re: LNET
« Reply #2 on: October 05, 2011, 12:27:51 pm »
Hi, I'm working in the same team with Rajiv. We are using lNetBase (console) version.

The Structure:
We have a class (called TalkHdlr) that manage connection, encoding, decoding of messages and also ping from server. This class is created on FormCreate. When we need to send a message the class check if in the stringlist there is present a connection with same IP:Port and if not it call the init procedure that creates a new one and add it's IP:Port to the list. In the init we Create a new TLTCP passing it a reference to main form, assigning all needed events, address and make a loop on .callAction until it become .connected or are passing 15 seconds, after this i enable the 100ms timer that calls .callAction.

The real use:
We have a timer that every 30 seconds try to send authentication message to server, and if the connection is not present it creates a new one as described above.

The test use:
In a test application i have a timer that every 30 seconds try to connect to server. I'v arrived to try to recreate TalkHdlr every time i try to connect and call directly the connection init procedure, but i get always the same error (IP:Port::Error): 0.0.0.0:8014::Error on connect: connection refused. The IP i try is real IP of server or DNS, but i get always that 0.0.0.0 in error.

As Rajiv said if we manually launch application after connection is up this mechanism works just perfect, it disconnects on network errors, connection down, unplugging of network cable ecc. and then when connection is restored it reconnects.
If we launch application with no network it gives same error always...

Shebuka

  • Sr. Member
  • ****
  • Posts: 429
Re: LNET
« Reply #3 on: October 13, 2011, 12:55:06 pm »
Hi, i have digged a bit more inside this thing and i noticed that when i start app with internet connection, lose it and try to reconnect, ResolveHostByName function takes like 1-2 seconds for execute, but if i launch my app with broken internet connection ResolveHostByName always take like nothing!
Can it be a bug inside netdb.pp? (maybe it never refresh the resolve file with dns servers? i see that at init CheckResolveFileAge is set to False, but i have no clue of how netdb works or how to properly init…)

Almindor

  • Sr. Member
  • ****
  • Posts: 412
    • http://www.astarot.tk
Re: LNET
« Reply #4 on: November 03, 2011, 03:16:42 pm »
Seems this is related to the netDB DNS resolving (which is blocking). I have a new motivation to write that non-blocking dns resolver :D

 

TinyPortal © 2005-2018