Help with IPCSocket on Windows

I’m trying to spot a problem with IPCSocket on Windows and need to know more about the IPCSocket.Path used for communications.

Basically I have an application which create an IPCSocket and intialize it with a

IPCSocket.Path = SpecialFolder.Temporary.Child(“com.mydomain.myapp.myID”).NativePath

then starts to Listen and launches a second application passing the socket path above to connect.

The problem arise on a particular machine: the connection opens on the child app (Connect event fires) and the child app start writing to the socket, -BUT- the listening app never connects and receive the data.

After many tries, I discovered that changing the IPCSocket.Path, either to another directory or just the name of the socket file, everything works.
This suggests me there is something related to the temporary folder on that machine.
Reinstalled Windows 7 from scratch and turned of the antivirus: same problem.

Now, since no real file is created on Windows, like on Mac, it’s very difficult to understand what happens.
It would help to have some more details on how Xojo handle this socket with a such “ghost” file, to better understand where the problem lies.
Btw, the documentation about IPCSocket says the file should be deleted after disposing the socket, but how I can delete a non existent file?

Any idea would be appreciated.

In the example, it goes as :

#If TargetWin32 Then CommSocket.Path = SpecialFolder.Temporary.Child("com.mydomain.test").AbsolutePath #Else CommSocket.Path = SpecialFolder.Temporary.Child("com.mydomain.test").ShellPath #Endif

The LR recommends explicitly an AbsolutePath under Windows. Maybe that is the use of the NativePath that creates the bug ?

Well, the LR recommends explicitly a NativePath, tough it makes no difference since NativePath and AbsolutePath are the same on Windows.

(But the code you posted is wrong for Mac, it needs a NativePath instead of a ShellPath)

IPCPaths are mysterious. I’ve used IPCSockets for years with the following code for both mac and win32:

  IPCSocket.path = "/tmp/MyAppName"  + "0000"

Where the “0000” vale is guaranteed to be unique, by using a Mutex, in cases where more than one app might be running at once.

I would really like to hear something from Xojo people about this fact.
Knowing some details about the the socket path would probably help to solve this problem.

[quote=90492:@Massimo Valle]Well, the LR recommends explicitly a NativePath, tough it makes no difference since NativePath and AbsolutePath are the same on Windows.

(But the code you posted is wrong for Mac, it needs a NativePath instead of a ShellPath)[/quote]

It comes from the example project code that works perfectly. I tend to believe what works is a good start :wink:

It works in most situations, but ShellPath is very different from NativePath (POSIX).
In the end, this code is old, I believe, and it can lead to difficult to track bugs.

[quote=90700:@Massimo Valle]It works in most situations, but ShellPath is very different from NativePath (POSIX).
In the end, this code is old, I believe, and it can lead to difficult to track bugs.[/quote]

Good luck, then.

I filed a report to update the example project to reflect what’s written on the Language Reference about the IPCSocket.Path.
<https://xojo.com/issue/33649>