Sending alerts to staff on a LAN without using "net send"

Posted on 2006-11-08
Medium Priority
Last Modified: 2013-11-13
Our receptionist would like a system where she can alert a particular member of staff when their client has arrived. We are unlikely to use "net send", as this introduces the likelihood of spam messages.

Here's how I envision the setup:
- a "receiving" application running on the staff workstations with a "sending" application running on the receptionist's workstation;
- text string (preset, maybe?) is sent by the receptionist via the LAN, then it would appear as a pop-up at the user's workstation;
- no additional communication is needed from the user to the receptionist;
- the staff do not necessarily use the same computer each time they work - we're networked via a Windows 2003 server, so users are identified by the receptionist by their username;
- ideally the alerts would be those cute little MSN Messenger-style ones with the text string inserted as the label, but I think I can do that part already.

Is this possible to implement without using "net send"? I have some knowledge of VB, but I haven't done much network-based programming.
Question by:skrysiak
  • 3
  • 2
  • 2
  • +2
LVL 41

Expert Comment

ID: 17899626
Most firewalls blocking incomming "net send" messages nowdays... so I'd think that using "net send" within your LAN would be a reasonable (and safe) approach.   Perhaps you might reconsider?

Expert Comment

ID: 17899687
consider using http://www.pandion.be/. It is like AIM except you control who can log on and keep it business related.

You can make your own but you better of taking a demo chat program written in VB and just customize it your way to save time and the hassle to learn something from scratch.

You can go to www.freevbcode.com and do a search on chat.

Here is one http://freevbcode.com/ShowCode.Asp?ID=7652


Assisted Solution

ShelfieldCollege earned 1200 total points
ID: 17901975
There are a number of ways you could do this...

The suggestion(s) above are both valid points.  If however you were looking at doing this completely yourself in VB and don't wish to use any previously created applications then you could consider the following:

Use a 'server' application which sits on the receptionists computer.  This application with listen for incoming connections from the client applications (which will sit on the users PCs).

Once the client has connected to the server it can send it a message telling the server who's currently logged onto the station (you can use some API calls to retrieve their username).  The server can then track who's connected from which machine and allow the receptionist to send them messages.

Commonly the connections and transfer of messages between server/client is done using the Winsock control.

As lunchbyte has suggested you can take a look around sites like www.freevbcode.com and www.planet-source-code.com where you'll find numerous examples of how to do this.

Hope this has helped, cheers

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

LVL 14

Expert Comment

by:Shiju Sasidharan
ID: 17904407
LVL 14

Expert Comment

by:Shiju Sasidharan
ID: 17904419

Author Comment

ID: 17937624
Okay, I've got a basic setup going on: a client app with a "listener" which waits for a string to be passed from the "server" app.

I've done some searching on P-S-C.com and freevbcode.com etc, but I can't work out how to use the required API calls. The "server" app needs to retrieve its own username (based upon the current user; we have 3 receptionists), then retrieve the usernames of all logged-in users on the LAN.

Presumably it would then be possible to pass a string to a client app sitting on the workstation of a particular user, selected from a list at the "server" app-side.

Accepted Solution

ShelfieldCollege earned 1200 total points
ID: 18065426
The way I would do it is to approach it from a slightly different method.

Have a server application which sits either on one of the receptionist's machines or on a server or some sort, then client applications which connect to the server application.

The server app could use an array of winsock controls to accept multiple connections.

When a client connects it should give the server the name of the person on the local machine and the name of the location machine.  The server should then store this some how, either in a collection or in the Tag property of the winsock control from which the client is connecting.

You could then give the receptionist's the option of sending messages out to everyone or to individual users who are logged in simply by looping the winsock controls currently loaded and checking their tag property, or by looping the collection object, whichever method you chose best.

For performance you would need to keep track of unused winsock controls that you have loaded, e.g. remember to unload the winsock when the user disconnects or when you forcefully disconnect them.  Best thing is to look for some example code on accepting multiple connections using winsock, the majority of these cover different methods of tracking the active controls.

Some example methods of getting the username of the person currently logged on and the name of the computer they are using which can then be sent to the server...

' API Calls
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long

Declare Function GetComputerName Lib "kernel32" Alias
"GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

' Public Functions
Public Function GetUser() As String
   On Error GoTo errH

   Dim sUser As String
   Dim lpBuff As String * 1024

   GetUserName lpBuff, Len(lpBuff)
   sUser = Left$(lpBuff, (InStr(1, lpBuff, vbNullChar)) - 1)

   GetUser = sUser
   Exit Function

   GetUser = ""
End Function

Public Function GetComputer() As String

  Dim strBuffer As String * 255

  If GetComputerName(strBuffer, 255&) <> 0 Then
     ' Name exist
     ComputerName = Left(strBuffer, InStr(strBuffer, vbNullChar) - 1)
     ' Name doesn't exist
     ComputerName = "N/A"
  End If

End Function

Note: above isn't my code, it's code I've found on Internet somewhere and I email it myself so I can access it anywhere without having to bookmark anything, so unfortauntely I can't give credit to the original author, can only state I didn't create it myself.  From what I've seen it's a pretty standard way of retrieving this information.



Author Comment

ID: 18130063
Thanks to everyone for their input!

I've now got a program using the code supplied by ShelfieldCollege, utilising the API calls I found in various LAN messenger apps on Planet-Source-Code. With the inclusion of the above code, the same program can be placed on all computers; its functionality changes depending on who is logged in.

Expert Comment

ID: 18131028
Glad you've managed to get your project working, cheers.

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

This article will show, step by step, how to integrate R code into a R Sweave document
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

589 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question