WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Sample code
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Sample Script to Send a Message to Another Computer using Mailslots

Keywords: 	  winpopup mailslot  send message sendmessage

Question:

I am looking for a head start or direction in creating a program that will broadcast a message to all NT users. The list of computers or NT users to receive the message will be a static file out on the network drive. I have attached my front end to this program. Any help would be greatly appreciated...

Answer:

A mailslot is a mechanism for one-way interprocess communications (IPC). A Win32-based application can store messages in a mailslot. The owner of the mailslot can retrieve messages that are stored there. These messages are typically sent over a network to either a specified computer or to all computers in a specified domain. A domain is a group of workstations and servers that share a group name.

You can choose to use named pipes instead of mailslots for interprocess communications. Named pipes are a simple way for two processes to exchange messages. Mailslots, on the other hand, are a simple way for a process to broadcast messages to multiple processes. One important consideration is that mailslots use datagrams, and named pipes do not. A datagram is a small packet of information that the network sends along the wire. Like a radio or television broadcast, a datagram offers no confirmation of receipt; there is no way to guarantee that a datagram has been received. Just as mountains, large buildings, or interfering signals might cause a radio or television signal to get lost, there are things that can prevent a datagram from reaching a particular destination. Named pipes are like telephone calls: you talk only to one party, but you know that the conversation is occurring.

I wrote a cute little script to send message to a WinPopup window. The script was easy to write. Finding the documentation was an entirely different matter.

Sample script to send a message to another computer using mailslots:

computername=AskLine("WinPopper","Enter destination computer or domain name","")
computername=StrReplace(computername,"\\","")
fromperson="Me"
toperson="You"
thetext="Make Money FAST!!!!!"



bb=BinaryAlloc(5000)
pointer=0
pointer=pointer+1+BinaryPokeStr(bb,pointer,fromperson)
pointer=pointer+1+BinaryPokeStr(bb,pointer,toperson)
pointer=pointer+1+BinaryPokeStr(bb,pointer,thetext)
BinaryWrite(bb,"\\%computername%\mailslot\messngr")
BinaryFree(bb)
Display(2,"All","Doned")

Article ID:   W13764
Filename:   WinPopup - Send Message to Remote Machine using Mailslot.txt
File Created: 1999:04:15:16:56:12
Last Updated: 1999:04:15:16:56:12