

bobD
Members-
Content Count
37 -
Joined
-
Last visited
Community Reputation
6 NeutralRecent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
should be simple: is computer on home network?
bobD replied to bobD's topic in Network, Cloud and Web
No, but it gets me from 'frequently' on the road to database running 'almost always', so that's worth doing--to me at least. And I'm willing to assume that the slow failure (a param presumably defaulted by Emb's IB engineers) is there for a reason . I'm happy at this point. -
should be simple: is computer on home network?
bobD replied to bobD's topic in Network, Cloud and Web
Because a TFDConnection connects very quickly, but takes a long time to fail, and it's annoying to sit and wait <g>. Gethostbyname fails a lot quicker. I do have a checkbox on the login form that allows overriding to local rather than network. This exercise is to see if there's a faster code option to set that check state automatically before the database code is invoked. bobD -
should be simple: is computer on home network?
bobD replied to bobD's topic in Network, Cloud and Web
As most do <g>, but unlikely then that they'd have a like-named server exposed to their guests, and even where that true, extremely unlikely that my db login credentials would work... So the connection attempt would fail and the program would fall over to the local db. It would just take longer. bobD -
should be simple: is computer on home network?
bobD replied to bobD's topic in Network, Cloud and Web
Program is a client/server design can that use either a tcp-ip connection to my home network database, or a local connection to an onboard copy. It should default to network if at home, and default to local if I'm on the road. It can also do things like demand additional authorization, etc. Here's what I've come up with so far: (actually, modified from code I found that you posted some 17 years ago); This isn't as clean as I'd like: rather than throwing away any non-local hits, I'd like a a call to something like gethostbyname that would only check the local 192.168~ address space. Haven't found a way to do that. Currently failure takes longer than success (though not as long as attempting to connect to an IB server that isn't there). unit NetworkPeerAvailable; interface uses winapi.windows, winapi.winsock, System.StrUtils; function PeerAvailable(const aTgtName : string) : boolean; implementation const internalIPMarker = '192.168.'; function PeerAvailable(const aTgtName : string) : boolean; type TaPInAddr = array[0..255] of PInAddr; PaPInAddr = ^TaPInAddr; var WSVersion : Word; WSAData: TWSAData; targetHost: PHostEnt; addr: PaPInAddr; UrlStr : string; begin Result := False; WSVersion := MAKEWORD(2, 2); if WSAStartUp(WSVersion, WSAData) = 0 then try targetHost := gethostbyname(PAnsiChar(AnsiString(aTgtName))); if Assigned(targetHost) then begin addr := PaPInAddr(targetHost^.h_addr_list); if Assigned(addr^[0]) then begin UrlStr := string(inet_ntoa(addr^[0]^)); if StartsText(internalIPMarker, UrlStr) then Result := True; end; end; finally WSACleanUp; end; end; -
"give it a fixed ip address outside the dhcp range" Unfortunately for this issue, I live in a building where the unit routers are provided as pretty much closed systems. Just about the only thing I have access to is setting the wifi password.
-
Basically, program needs to act differently if at home or away--so how do I know? I've looked at using Winsock and HostEnt := gethostbyaddr(@SocketAddr.sin_addr.S_addr, 4, AF_INET); and although that tells me if my home interbase server is available, in a dynamic DHCP environment that IP address isn't necessarily constant. And a call to addr 192.168.1.1 (home router and default DNS gateway) returns nil: the peer computers respond, but the router doesn't. Is there another way to get the name of the local network LAN that works both wired (desktop machines) and wifi? I'd like to try using winsock's gethostbyname but I haven't found a good use example. Or is there a better way? bobD
-
Definitely a name resolution problem, and I'm still blaming the OS updates. I did originally (years ago--like D7 era) start with calling the server 192.168.~ rather than by name in the connection parameters, but the router at that time (w/ dynamic DHCP services) would periodically reassign IPs, so that proved less stable than the name approach. Tentative solution for now: I turned on network sharing and discovery and redefined the network as private. Then I put incoming traffic rules on the server firewall for interbase as a program, and to open port 3050 specifically. My wife's laptop now appears to have a stable connection. Things I'm unhappy about; i don't like discovery and sharing on. Seems like an obvious security hole to me, and since my own laptop had a stable db connection without it, it's obviously not the root issue. It still bothers me that her machine could contact the database on start=up, but then lost it. That's just weird. bobD
-
I'll have to add some debugging code to the program to surface that. It's a straight db access program, so if it can't connect it simply tells the user that it can't find the database. It's my password manager, so not designed to be real helpful to an unauthorized user. I'm still loooking at something external as the most likely issue, though. Both laptops are running the same build of my code ("UTC build date: Sat, 27 May 2023, 8:26 PM") and this is a very recent issue. Interestingly enough, if I try to log in to the network server using the Emb. IBConsole program on her machine, I get a failure dialog message of: Unable to complete network request to host "<NAME>". Failed to locate host machine. The specified name was not found in the hosts file or Domain Name Services. while doing so from my laptop works fine. I have no idea why it suddenly can't find a database server it's been using for several years. bobD
-
I have a licensed IB server on my home network, accessed both hardwired (desktop machines) and over the network wifi On my laptop the connection is rock solid On my wife's laptop my Delphi program will connect when the computer is first booted up, but then consistently fails after a couple of minutes Same Delphi program, same build, same connection parameters. And as stated, it works on startup--just not later. This only started about a week or so ago, and since everything else is pretty much identical, I'm suspecting the latest Windows update: my laptop is Win11 and hers is Win10. Since my laptop always connects, I'm tending to rule out the server or connection settings...what else could it be? I did set up a new rule in the Windows firewall to allow outbound connection from my Delphi program, but that had no effect. I even tried turning the firewall off: again, no effect. I'm perplexed. Anyone seen anything like this--connecting on a fresh boot, but then consistently failing? bobD
-
The machine identifies its connection as 'public'. It's a hardwire (not WiFi) connection to my router. Additional details in response to tgbs. It could be that that changed with a router reboot--I'm not sure of the basis on which the db server or router decides how to characterize the connection as public or private. The firewall rules do segregate the local connections (I assume by seeing the calling IP address as 192.168.*). I'd like the Interbase3050 rule to only accept calls from this side of the router, but it wasn't at all obvious to me how to configure that.
-
I ended up adding both: an allow inbound program rule for ibserver.exe, an the same rule for port 3050 tcp. I have no idea how the previous Interbase exceptions got dropped, though the firewall control panel looks nothing like it once did, so I have to assume it's bee evolving with Windows updates. Anyway, all the db clients now connect again with the Win Defender Firewall monitoring local area connection calls What I don't know is whether that's overkill: If I disable the ibserver program rule and just leave the port open everything still works, including connecting to the server with IBConsole from my Delphi development machine, but ISTM that I remember something Interbase needing a UDP connection. Am I misremembering? I don't know if Embarcadero removed that dependency, or I just didn't test enough to catch what's missing... bobD
-
Suddenly today my home network IB 2020 server is getting blocked by the Windows Defender Firewall. If I turn off the firewall for the local area network everything works, so I know it's definitely a firewall configuration issue The server has been solid for some time and I haven't changed anything other than applying Windows updates as they come out. I'm suspicious that a Windows Defender update might have wiped some of my settings. Context: home local area network; all connections should be coming from 192.168.4.* IB server is on an up-to date Win10 Pro box Anyone have a current firewall requirements link or cheatsheet for an IB 2020 server on a Win10 Pro machine? TIA, bobD
-
Sounds like a reasonable hypothesis, because this has been my main development machine for a few years now, and has seen multiple IB versions. Also the results are the same whether I try the sample app, or connecting to a local copy of my actual intended target db. I'll try to see what I can find this week after looking at cleaning up the installation. Thanks, bobD
-
Thanks for response. I also looked at and followed along with the set-up demo at but no joy. At the end the project could not connect. Still trying to figure out what's wrong with the installation. May try uninstalling and reinstalling PAServer next. I have similar outcome with the FireIBLite.dproj sample. If the local IBServer is running, I get a user name and password not defined error, If I check the Lite option and stop the local server, then I get database unavailable. Very frustrating... bobD
-
Why isn't this dangerous, or is it?
bobD replied to Renate Schaaf's topic in Algorithms, Data Structures and Class Design
Absolutely. The inclusion of Free in the instance method is essentially a side-effect of the method and constitutes a violation of the SRP. What if I want to call DoSomething twice? Also, as a matter of consistency I personally always call the inherited constructor--even when descending from TObject directly. I have no guarantee that TObject.Create will always be an empty method.