Very Odd Daemonize Issue

I had the weirdest thing happening on only my code builds where my console app would connect to my server twice at a time. If I run it from the IDE as a console app it connects once as expected just fine. I troubleshot it down to my Daemonize call in my App.Run event. The weird thing is that this weird double connect issue only happens when I am using Daemonize in a Build not the IDE.

// Only Call Daemonize when we Build
#If DebugBuild = False And TargetMacOS = True Or TargetLinux = True Then
Call Daemonize
#Elseif DebugBuild = False AND TargetWin32 Then
// Add Service stuff later
#EndIf

I verified that my TCPConnect Subclass was working fine and it is. THen If I simply comment out the block above, build, and test the double connect issue goes away. :slight_smile: Weird.

Am I calling Daemonize wrong?

I am doing all of this testing on Mac OS X 10.9.1 and I know using LaunchD is preferred here, but I wanted to try Daemonize first.

Thanks again everyone.

#If DebugBuild = False And (TargetMacOS = True Or TargetLinux = True) Then

Perhaps missing ()???

Ha thanks Dave! That wasn’t the issue, but you got me noodling in the right direction and I changed around how I was calling the Connection Thread. I changed calling my thread until after the daemonize and it now works as expected. Thanks for helping!

  #If DebugBuild = False And (TargetMacOS = True Or TargetLinux = True) Then
    Call Daemonize
  #Elseif DebugBuild = False AND TargetWin32 Then
    // Add Service stuff later
  #EndIf
  
  EVIP_Thread = New EVIPThread
  EVIP_Thread.Run