Recent

Author Topic: Issue with Lnet on mac (Sierra)  (Read 806 times)

LittleBritaly

  • New Member
  • *
  • Posts: 20
Issue with Lnet on mac (Sierra)
« on: July 09, 2020, 02:53:05 pm »
I have an infuriating issue with trying to make a connection between a cleint and a server using the TCP Component of Lnet.

I am using the TCPUDP example which is essentially a small chat  server / client.

When compiled on Windows, it works fine, both the client and server can connect and send information between the two and exactly meets my requirements (well, it would if it would work)

On the mac version, it compiles and runs, but when I try and connect nothing happens, no "events" are triggered.

I can connect to the "mac" server from the "windows" client and get a notification on the windows version "Connected to remote host", but (for example), the "TFormMain.LTCPComponentAccept(aSocket: TLSocket);" event is not triggered on the mac version.

 All i really want to do is eventually have a remote (mac) machine automatically send a short message at intervals each day (it musn't be email or imessage), Lnet seems the simplest way to achieve this (I couldnt find any simple examples for Indy, Synapse).

I'd much prefer to use fcl-net, but again can't find a simple example.

Can anyone advise what could be the issue ? , or some example code for fcl-net ?

MarkMLl

  • Hero Member
  • *****
  • Posts: 1222
Re: Issue with Lnet on mac (Sierra)
« Reply #1 on: July 09, 2020, 03:22:27 pm »
Where did you get lNet? If it was Github then I suggest asking there, although the developers aren't very active. If it's the one bundled with FPC then it's not intended for general use, I've done a bit of maintenance on it (to allow a program to implement a Telnet client without pulling in external libraries) but it really is very much at EOL (I was tinkering with the Telnet server side a few days ago and really didn't enjoy it at all).

You have, I presume, seen https://wiki.freepascal.org/fcl-net ?

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

GetMem

  • Hero Member
  • *****
  • Posts: 3757
Re: Issue with Lnet on mac (Sierra)
« Reply #2 on: July 09, 2020, 03:25:19 pm »
Hi LittleBritaly,

I'm not familiar with lnet, however under linux the port should be above 1000, ports below 1000 are reserved. If lnet is threaded, make sure that threading is enabled(only applies to older versions of Lazarus). What error(s) are you getting?
If everything fails you can switch to Indy or Synapse, both works on window/linux/osx. Converting your application shouldn't be too difficult. Also you can find a few example on this forum.

MarkMLl

  • Hero Member
  • *****
  • Posts: 1222
Re: Issue with Lnet on mac (Sierra)
« Reply #3 on: July 09, 2020, 03:33:33 pm »
I'm not familiar with lnet, however under linux the port should be above 1000, ports below 1000 are reserved.

1024 on Linux, not sure about Mac. Can be relaxed using POSIX capabilities. I agree that OP needs to consider this.

Quote
If lnet is threaded, make sure that threading is enabled(only applies to older versions of Lazarus).

It's not.

MarkMLl
« Last Edit: July 09, 2020, 04:39:57 pm by MarkMLl »
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

LittleBritaly

  • New Member
  • *
  • Posts: 20
Re: Issue with Lnet on mac (Sierra)
« Reply #4 on: July 09, 2020, 04:53:19 pm »
Thank you both GetMem and MarkMLI.

I wsn't getting any errors at all, just nothing seemed to happen on the mac version.


I got Lnet from the Online Package Manager, I also installed Codetyphon and compiled the demos using that, i got the exact same results.

I was using port 5000.

I struggled with the demos i found of Synapse and Indy, the code for the threads was beyond my understanding.

All I want to do is have the client (on a dynamic ip address) check in with a server at a fixed ip every 15 minutes or so and for the server to be able to send a command back to the client.

I've just really found fcl-net, but can't at the moment find code similar to what the Lnet example does.


 

MarkMLl

  • Hero Member
  • *****
  • Posts: 1222
Re: Issue with Lnet on mac (Sierra)
« Reply #5 on: July 09, 2020, 06:54:23 pm »
Which lNet example are you using, and have you looked at the fcl-net examples in the FPC source I pointed you at (via the wiki page)?

Are you absolutely sure that your lNet code was invoking CallAction()?

I'm unhappy that Online Package Manager is fetching unsupported code without a health warning. I was trying to persuade one of the core developers that the lNet documentation should be made available via the main FPC documentation page but he refused because "lNet isn't part of FPC", but this really is a support nightmare.

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

GetMem

  • Hero Member
  • *****
  • Posts: 3757
Re: Issue with Lnet on mac (Sierra)
« Reply #6 on: July 09, 2020, 07:52:56 pm »
@MarkMLl
Quote
I'm unhappy that Online Package Manager is fetching unsupported code without a health warning.
Then please report here https://forum.lazarus.freepascal.org/index.php/topic,34297.0.html so I can fix it. Is lnet from OPM obsolete? Is lnet still actively developed? I must rely on other members help, otherwise OPM won't be sustainable on the long run.
« Last Edit: July 09, 2020, 07:59:26 pm by GetMem »

dsiders

  • Sr. Member
  • ****
  • Posts: 374
Re: Issue with Lnet on mac (Sierra)
« Reply #7 on: July 09, 2020, 08:20:49 pm »
@MarkMLl
Quote
I'm unhappy that Online Package Manager is fetching unsupported code without a health warning.
Then please report here https://forum.lazarus.freepascal.org/index.php/topic,34297.0.html so I can fix it. Is lnet from OPM obsolete? Is lnet still actively developed? I must rely on other members help, otherwise OPM won't be sustainable on the long run.

Their GitHub page claims all code was compiled with Lazarus 2.0.4. You can draw your own conclusions.
Lazarus 2.1 (SVN) / FPC 3.0.4 / FPC 3.2.0 / x86-win64 / Windows 8.1

GetMem

  • Hero Member
  • *****
  • Posts: 3757
Re: Issue with Lnet on mac (Sierra)
« Reply #8 on: July 09, 2020, 08:39:36 pm »
@dsiders
Quote
Their GitHub page claims all code was compiled with Lazarus 2.0.4. You can draw your own conclusions.
Actually the OPM version was older. I updated from github

@LittleBritaly
Please reinstall lnet again, maybe if you are lucky the linux/osx issues are gone(not likely though).
« Last Edit: July 09, 2020, 08:50:08 pm by GetMem »

MarkMLl

  • Hero Member
  • *****
  • Posts: 1222
Re: Issue with Lnet on mac (Sierra)
« Reply #9 on: July 09, 2020, 10:02:54 pm »
@MarkMLl
Quote
I'm unhappy that Online Package Manager is fetching unsupported code without a health warning.
Then please report here https://forum.lazarus.freepascal.org/index.php/topic,34297.0.html so I can fix it. Is lnet from OPM obsolete? Is lnet still actively developed? I must rely on other members help, otherwise OPM won't be sustainable on the long run.

Unless you have some way of determining whether the author of a particular package is actually responding to queries and- where necessary- fixing bugs then you're right: it's not sustainable. Sorry.

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

LittleBritaly

  • New Member
  • *
  • Posts: 20
Re: Issue with Lnet on mac (Sierra)
« Reply #10 on: July 10, 2020, 08:47:41 am »
I haven't had the time yet to look at fcl-net due to workload, but will try over the weekend, thank you.

In the meantime, I thought it would be a good idea to let you know exactly what is happening, these are all the same sourcode, but compiled on the operating system it is running on.

I have Client1, a Windows 7 virtual client on mac osx Sierra machine (it has it's own ip on the network).

Client2, Mac Sierra

Server1, A Windows 10 Laptop.

Server1 is listening for connections, on Client 1 I click connect, Server1 displays "Connection accepted", Client1 displays "Connected to remote host".

I can send the conents of an edit box between the two, no problem, both systems display the message.

When connecing from the mac/Client2, Server 1 display's "Connection accepted", however, Client2 does not display anything (the onconnect event doesnt seem to get fired).

If i then send a string from the server, it shows up on Client1, but not Client2.

If I send a string from Client2, i get "Error on connect: connection refused" on client2, on Server1 I get "Connection Lost", Client1 is still connected.

It's as if no events on the mac version of Lnet are getting fired.

I'm happy to try any change of code/ recompile Lnet with any suggestions / ideas .

(Hope the above makes sense, please lt me lnow if i've not made the setup clear)



 

MarkMLl

  • Hero Member
  • *****
  • Posts: 1222
Re: Issue with Lnet on mac (Sierra)
« Reply #11 on: July 10, 2020, 09:21:02 am »
@LittleBritaly No, that doesn't make sense at all I'm afraid since all you're doing is telling us what error messages would be displayed without showing us what's actually generating them.

Two things to try before you change anything. First, when the server is running on the Mac does netstat (probably with the -a -n options) tell you that something is listening on the expected port? Assuming obviously that the Mac has Netstat, or that you can get a copy. Second, try hooking the Lazarus debugger onto the callaction entry point in the lnet library.

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

LittleBritaly

  • New Member
  • *
  • Posts: 20
Re: Issue with Lnet on mac (Sierra)
« Reply #12 on: July 10, 2020, 12:41:51 pm »
netstat shows the following when I run the mac as the server.

tcp4       0      0  *.5000                 *.*                    LISTEN

I'd used Network Utility on my mac before posting on the forum as well so
I can also telnet localhost 5000 and appear to be connected, only the connect event is not triggered, if I click disconnect on the server, the telnet connection is dropped.

Further testing has shown that UDP partly works as I can send a message from the mac to windows server.

I'm going to try another couple of thngs before trying to debug, 1) try the code on a different mac and 2) run the same code on a Linux machine in an attempt to see if it is machine specific or operating system specific.


MarkMLl

  • Hero Member
  • *****
  • Posts: 1222
Re: Issue with Lnet on mac (Sierra)
« Reply #13 on: July 10, 2020, 12:53:38 pm »
I know this is a silly thing to ask, but are you sure that it's actually your code on port 5000? If I look at Nmap's list of known services port 5000 is upnp.

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

LittleBritaly

  • New Member
  • *
  • Posts: 20
Re: Issue with Lnet on mac (Sierra)
« Reply #14 on: July 10, 2020, 05:32:59 pm »
It's not a silly thing at all Mark, it wouldnt be the first daft thing I've ever done.

It is definitley the code on port 5000, the demo code was originally on port 4665, which after initial testing I relaised something was using that port (so switched to another free port, 5000 just happened to be a random one i thought of).

I also initially had trouble using telnet, no matter what port I targeted, it looked as if it had logged in instead of giving the "Unable to connect to remote host" message.

It turned out that BitDefender was the culprit, even though it was supposed to have been closed down, after I uninstalled BitDefender (Antivirus) , the port became available and telnet worked as it should.

 

 

TinyPortal © 2005-2018