Inorder to list all the workstations on a LAN, i have used NetServerEnum() after importing it.
On running the program, it seemed to work fine. The two existing machines were detected correctly. However, i want the list to be refreshed whenever required (some refresh button). So i detached the wire of the other computer from the switch, rendering only a single computer on the LAN. Now, when i ran the program, it still lists out the disconnected machine.