Click here to Skip to main content
14,979,508 members
Articles / Desktop Programming / WTL
Posted 26 Jun 2003


23 bookmarked

Sending Anonymous net send messages in WTL

Rate me:
Please Sign up or sign in to vote.
4.32/5 (28 votes)
26 Jun 20035 min read
This article explains how you can can send anonymous net send messages to any host


This article explains how to send anonymous net send messages across the network. My intent is not to explain how to send junk anonymous messages to tease others. The intent is to explain how this thing can be useful for customized applications.

For beginners, let me first explain what net send utility is all about? What are net messages and how it works?

What is net send, net messages and how does it work?

Net send is used to send messages to any host on network (LAN or the internet) where messenger service is running. Moreover on local computer workstation service should also be enabled. On command prompt or run write this command and press enter.

Net send IPAddress yourmessage

This will send a message to that particular user and a popup dialog box will appear on his screen if his messenger service is running. You can also use hostname of that computer or any "message alias". What?? What is message alias? On windows 2000 and onwards, messenger service maintains a list of message alias in a table known as message name table. Message alias is just a name or any string. By default, computer name and current session name are added to this alias table. But you can add your own message alias by registering it in alias table by using this command.

Net Name newmessagealias

Messenger service receive all messages whose recipients belong to alias table maintained by it. So if some other user on network type "net send newmessagealias message" it would be send to the host containing this message alias. You can retrieve list of registered message aliases by using following command.

Net Name

Following image shows the net send popup dialog box. I hope this is sufficient information for understanding net send and net messages

So how to send anonymous net sends

Now you understand the working of net send so lets come back to our original topic.

Have you ever encountered anonymous net send messages? When you receive a net send message, generally host name of the sender is mentioned there. However, it is not necessary that this name should always be the host name of the sender; it can be any name using the technique provided in this article. But if you are using net send utility to send this message then it always the hostname of the sender. Note that the name which appears on net send dialog box is not the message alias of the sender. Sending anonymous net sends is surprisingly easy.

Sending anonymous messages to some user can sometimes be fun but at times it can create problems for other users. However, it can be useful if you have an application which uses customized names to send messages to each host. So the use depends on your needs.

Net Send utility uses APIs provided by Microsoft LAN Manager. To send a message, you have to register the message alias in message name table. This is done through NetMessageNameAdd function. Only members of local administrator group can execute this function. As mentioned earlier, host name of computer is by default added to message alias table, so you can even send messages without registering a new alias. But I am doing so for explaining the whole process. However, this is not the actual thing which makes anonymous net sends possible. Once you have registered any message alias in message name table, you can use NetMessageBufferSend function to send the popup message to any host.

The sample application provided with this article is a dialog based WTL application which can send anonymous messages to many hosts at a time. Using this utility you can even send message to more than a thousand hosts. You need to provide a list of IP Addresses in a file named checkhost.txt. This program expects one IP Address in one line of this text file. For further information, you can open the file provided with sample and check it. NetMessageBufferSend accepts 5 arguments. First one is server name which is local host if it is NULL, second is message alias which you created, third is the name of the sender ( Got any idea how this works?), fourth is the pointer to message itself and last is the size if the message. So it is the “from” field of this function which makes it all possible. It can be any anonymous name. Following code shows how to send this message

// we have added a message alias of RECTOR

NetMessageBufferSend( NULL, server, from,
 (byte *) &msg,wcslen( msg ) * 2 );


// "server" is a Unicode string containing IP Address  
// whom you want to send
// "from" is the actual field which makes it all happen.  
//It is Unicode string and it contains the name from
// which this message is coming from. So you can specify
// any anonymous name and it will appear on receiver end
// we are multiplying the length of message by 2 
//because it is a Unicode string which 
//corresponds to 2 Bytes for a single character

This is not the actual code taken from sample application. This is just to demonstrate the whole process.

In sample application on clicking the broadcast button, first i retreive text from editbox and convert the char string to unicode character string using mbstowcs function ( these network functions require unicode string).Then i go in loop and create a thread for each message i want to send.In thread i simply send the message using NetMessageBufferSend function.Thats it :).

To send messages to your own hosts, you need to change the checkhosts.txt file to remove my added IP addresses and add those hostnames or IP Addresses whom you want to send message.

I hope you enjoyed this small article :)

Updates ( 29th June 2003)

  • Added more explanation about working of net send and net messages
  • Added explanation about sample code


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
Pakistan Pakistan
No Biography provided

Comments and Discussions

GeneralMy vote of 3 Pin
Mahdi Nejadsahebi17-Feb-12 20:01
MemberMahdi Nejadsahebi17-Feb-12 20:01 
QuestionDoes it work? Pin
duaatul25-Apr-07 6:18
Memberduaatul25-Apr-07 6:18 
AnswerRe: Does it work? Pin
Sushi00729-May-07 21:23
MemberSushi00729-May-07 21:23 
Generalpopup shows "???..." in mfc application Pin
DiscoverSK26-Sep-06 20:02
MemberDiscoverSK26-Sep-06 20:02 
Questionhow to send msg in Lan Pin
R.Nagendran28-Aug-06 7:15
MemberR.Nagendran28-Aug-06 7:15 
Questionhow to send msg Pin
ramanes202025-Apr-06 6:50
Memberramanes202025-Apr-06 6:50 
Questioncan track net send messages?? Pin
Anonymous8-Jul-05 18:37
MemberAnonymous8-Jul-05 18:37 
AnswerRe: can track net send messages?? Pin
Anonymous26-Sep-05 12:26
MemberAnonymous26-Sep-05 12:26 
QuestionRe: can track net send messages?? Pin
Rahul D.11-May-08 22:30
MemberRahul D.11-May-08 22:30 
GeneralUsing "Net Send" over the internet Pin
infinity86-Jun-05 8:33
Memberinfinity86-Jun-05 8:33 
Generalreceive message. Pin
Tailana31-May-05 22:31
MemberTailana31-May-05 22:31 
Generalreceive message. Pin
Tailana31-May-05 22:30
MemberTailana31-May-05 22:30 
Generalwat do i type Pin
Robbo_bjm29-Jan-05 12:41
MemberRobbo_bjm29-Jan-05 12:41 
GeneralRe: wat do i type Pin
Chris Nooyen24-Feb-06 2:30
MemberChris Nooyen24-Feb-06 2:30 
GeneralLogging net send messages Pin
Member 26322427-Jan-05 1:06
MemberMember 26322427-Jan-05 1:06 
GeneralRe: Logging net send messages Pin
Aamir Khan Jadoon7-Jan-05 2:44
MemberAamir Khan Jadoon7-Jan-05 2:44 
GeneralRe: Logging net send messages Pin
CyKill24-Apr-05 7:20
MemberCyKill24-Apr-05 7:20 
GeneralGreat Work man!!!!! Pin
Member 178714324-Nov-04 9:15
MemberMember 178714324-Nov-04 9:15 
GeneralRe: Great Work man!!!!! Pin
Venomus11823-Feb-05 15:12
sussVenomus11823-Feb-05 15:12 
Generalcan't get this to work Pin
woodcock6826-May-04 3:01
Memberwoodcock6826-May-04 3:01 
GeneralRe: can't get this to work Pin
abc87626-May-04 8:08
Memberabc87626-May-04 8:08 
GeneralRe: can't get this to work Pin
woodcock6826-May-04 9:08
Memberwoodcock6826-May-04 9:08 
coolcars19-May-04 6:26
Membercoolcars19-May-04 6:26 
abc87624-May-04 18:50
Memberabc87624-May-04 18:50 
Anonymous9-Jun-05 23:04
MemberAnonymous9-Jun-05 23:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.