Use the Messenger Service on the web

Source: Internet
Author: User
Tags net send

A web project was developed some time ago. The customer requested the instant message function:
1. The client cannot install software;
2. The client can receive instant messages without opening the webpage.
3. No matter whether the client is using any software, instant messages must be immediately visible to the customer.
Considering that the customer's network environment is a simple peer network, the work group is used to allocate various departments of the Organization, so the instant messaging service is used to solve the problem.
Below isCode, Hope you can provide comments and suggestions

Using system;
Using system. runtime. interopservices;

Namespace Test
{
/// <Summary>
/// Summary of netsend.
/// </Summary>
Public class netsend
{
Public netsend ()
{
//
// Todo: add the constructor logic here
//
}

Public int sendmessage (string sfrom, string sto, string smessage)
{
Byte [] bbuffer = system. Text. encoding. Unicode. getbytes (smessage );
Int nret = netmessagebuffersend (null, sto, null, smessage, smessage. length * 2 + 2 );
Return nret;
}

[Dllimport ("netapi32", charset = charset. Unicode)]
Public static extern int netmessagebuffersend (string servername, string msgname, string fromname, string Buf, int buflen );
}
}

Supplement the net send Syntax:
Net send {name | * |/domain [: Name] |/users} message

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.