Solved

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

Posted on 2006-11-08
9
574 Views
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.
0
Comment
Question by:skrysiak
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 41

Expert Comment

by:graye
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?
0
 
LVL 5

Expert Comment

by:lunchbyte
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


0
 
LVL 4

Assisted Solution

by:ShelfieldCollege
ShelfieldCollege earned 300 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

Matt
0
 
LVL 14

Expert Comment

by:Shiju Sasidharan
ID: 17904407
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 14

Expert Comment

by:Shiju Sasidharan
ID: 17904419
0
 

Author Comment

by:skrysiak
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.
0
 
LVL 4

Accepted Solution

by:
ShelfieldCollege earned 300 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

errH:
   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)
  Else
     ' 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.

Cheers

Matt
0
 

Author Comment

by:skrysiak
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.
0
 
LVL 4

Expert Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

895 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now