unable to resolve host name. lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- taazz · 2012-09-09 14:10 Hi everyone I'd appreciate any hints on this. I've started playing around with indy and specifically with pop3/smtp and imap clients, well that was the plan at least you see I stabled on a problem with pop3 and didn't actually touched the rest yet. to cut a long story short indy uses TIdStackWindows.HostByName to convert the hostname to IP address and this internally calls IDNToPunnyCode which in turn is a wrapper around the windows own IdnToAscii system procedure which returns the error with OS Code 123 which translated by the OS reads The filename, directory name or volume label syntax is incorrect. which tells me that my host name (pop.freemail.gr) is not correct which is funny because using ping from a command prompt it resolves correctly to an ip address and answers back too. I'm at a wits end here I can't understand why and on top of that I cant find info on the rules for IdnToAscii are  nowhere in microsoft's site. details OS          : Windows 7 ulitmate 32 bit H/W       : wifi connection from an acer laptop. LAZ/FPC : Lazarus 1.0 r38415 FPC 2.6.0 i386-win32-win32/win64 Long post? sorry I had to vent a bit. Any info would be appreciated. ---------------------------------------------------------------------- ludob · 2012-09-09 14:41 What version of indy is this? Version 10.8401 is using gethostbyname in winsock2 to resolve the name on win32. Only when that is not working it uses the windows getaddrinfo api. IDNToPunnyCode and IdnToAscii are unicode routines not related to host name resolving. The IdnToAscii  functions is imported from Normaliz.dll which is normally in Windows\system32. Edit: actually it skips gethostbyname when on win9x and if Win32MajorVersion<5 ---------------------------------------------------------------------- taazz · 2012-09-09 15:16 the indy version shown in the right click popup menu says 10.5.8.0... when I press it to show the about box it raise an exception saying that TBitmap:unsupported resource type : XPM resource name : IndyCar so I can't really see the complete version. I do not recall where I found it, but I might have reaped it of from codetyphon that I was evaluating earlier this summer.  So I suppose I will have to play around with the defines to make sure that the delphi unicode strings do not interfere with the current implementation I guess. Is there any string type compatible with delphi's unicodestring in lazarus 1.0 fpc 2.6.0? thank you for hint I'll look in to it. ---------------------------------------------------------------------- ludob · 2012-09-09 15:28 Since you are not using unicode I would try to change the lineCode: [Select]if UseIDNAPI then begin into Code: [Select]if false and UseIDNAPI then begin so that you always doCode: [Select]LTemp := AHostName; I'm looking at a later snapshot so YMMV. The idea is to skip the IDNToPunnyCode to better isolate the problem and leave it out if that works ---------------------------------------------------------------------- taazz · 2012-09-09 15:59 I'm looking in to it as we speak, I came to the conclusion that the define UNICODE_BUT_STRING_IS_ANSI should be active inside lazarus, since (and correct me if I'm wrong) the string type is equal to ansistring at this version at least. If that define becomes active then everything should fall in to place. I would hate to disable a check and hit head on, on an other wall down the road. Although I do expect to hit a few more walls before I'm finished I'd rather avoid the ones that have already been taken care for me by others. ---------------------------------------------------------------------- taazz · 2012-09-09 18:26 well tried my best to make it work even changed the IDNToPunnyCode to use UnicodeString and WideString with conversion from the string type to each one and every and single time the result was the same I nit the bullet and added Code: [Select]  {$IFDEF FPC}   Result := False;   {$ENDIF} in the end of the UseIDNAPI function. at least now I can actually connect using the server name instead of the ip but I'm going to upgrade to the latest indy release as soon as it comes out. I hear it has more lazarus support and is not long now. Oh well Now I'm having a different problem my dummy account has 2 messages (that I send specificaly for testing) and the indy's own sample returns 0. ---------------------------------------------------------------------- taazz · 2012-09-10 18:55 any one knows a good RFC compliant email server for windows preferable not service oriented that I can use to debug by pop3, smtp and IMAP code? I don't mind feading it a couple of emails to get me started but I would appreciate if it could keep a backup when deleting and restore them for the next connection. Tried to google and found a few, most of them had annoying bugs that I couldn't overcome eg rejecting authentication for no apparent reason or crashing down the moment I created an account and such, I'm going to evaluate hMailServer in a bit. Any other recommendations?