Get Client computer name/IP Address from Server Side


I made a development which uses Navision Socket Bus Adaptor. On the server (native) there is a CU that searches for idle users on fixed intervals and if finds, it sends messages to one computer name. It’s something like:

OutMsg := ComCom.CreateoutMessage(‘Sockets://Computer1:8079’);

OutS := OutMsg.GetStream();

On the clients I have a single instance CU that receives the message and closes that client.

The problem is that I don’t know the computer name/IP address of the idle user from Nav server. Is there any way to find the computer name asociated with one session in Nav? The command ENVIRON(‘clientname’) works only if the client is connected through remote. Or, is there any way to send messages through sockets to the entire network? This way, transmitting the userid from the server, only the client with that ID will close.

Thanks in advance and have a nice day!

Why don’t You just write a post in a table with the session-id and let the single instance codeunit on the client look for the “My Session”-id in that table and if it’s there close the client. That’s just another way of communicating.


Thanks for your answer Lars. I thought at your idea and in this scenario I should use some Timer automation in that CU that would check at specified intervals if client session ID is in that table. But that would mean that the client is not idle anymore if it executes code at specified intervals.

Currenly, I figured out a solution (not the best I’m affraid) in which I send compuer name and current Session ID to a table. Using Socket Bus Adaptor, I send message to the idle client using its computername and close it. Of course, I erase the line from that table before closing the client and again, in function LogInEnd in CU1 I added code to erase the corresponding line from that table if client himself closes Navision. The problem is I cannot be sure if everytime the information from that table is erased, e.g. - the client crashes and it won’t execute code from LogInEnd function in CU1.

I tried all the communication components from Navision SDK:

  • Socket Bus Adaptor - Sends messages to one specified compuer name. I could’t figure out if it’s possible to “broadcast” messages to all network, but I don’t think it’s possible

  • Named Pipe Bus Adaptor - works only if using two clients on the same machine (I’m using Navision Database Server)

  • MS Message Queues (apparently the best communication solution) - tried with private queue - the server write message to this queue (created on the machine with the server) and only the first client (which uses single instance CU) that receives the message processes it, then the message is destroyed. Is there any way that all the computers in a network to receive a message from a queue?