Protocols/MSNP/MSN Protocol Version 8
What is MSN Messenger?
The term 'MSN Messenger' is quite ambiguous, as Microsoft use the term to refer to several different parts of their instant messaging solution. You chat over the 'MSN Messenger network', the most popular program to connect to the MSN Messenger network is 'MSN Messenger', and the language that programs on the MSN Messenger network speak is 'MSNP', the Microsoft Notification Protocol.
What is the MSN Messenger Network?
The MSN Messenger network is a presence and instant messaging network from Microsoft. It went online in July 1999, and is neither the first nor the last instant messaging network. MSN Messenger is among the top four proprietary instant messaging networks. As of March 2003, there were far fewer unique users on the MSN Messenger network than on AOL Instant Messenger or ICQ but more than on Yahoo Messenger.
What is the MSN Messenger Protocol?
The MSN Messenger protocol consists of a series of commands sent between the client and the server. For example, when someone on your contact list signs out, the server sends a message like this to your client: FLN email@example.com. On receiving this, the client should mark that contact as offline.
The MSN Messenger protocol has undergone several revisions over the years. Microsoft's servers allow clients to use versions 8, 9, 12, 13, 14 & 15 of the protocol. Individual protocol versions are often written as 'MSNP8', 'MSNP9' and 'MSNP12', which stands for Microsoft Notification Protocol and is followed by the version number of the protocol.
This site intends to fully document the MSN Messenger protocol and quirks of MSN Messenger servers so that third party software developers can write their own programs to interact with the network.
The information on the protocol was gathered by reading the official IETF draft, reading various sources, analysing packets, analysing the official client, and writing programs. Most of this work was done by other members of the MSN Messenger research community, which we have just written up. If you have discovered something new about the protocol, please make it known in the forum.
What is the MSN Client Protocol?
The MSN Client protocol consists of messages sent between clients. For example, when you say "hello" to a friend, your client sends a message to their client with hello as the body of the message.
Until relatively recently, the MSN client protocol grew quite organically - one version of the official client would behave differently to another, and you just had to guess what behaviour was expected by whom. Recently, attempts have been made to impose a version numbering system.
This site intends to fully document the MSN client protocol and quirks of the official client so that third party software developers can write their own programs to interact with the network. We hope to fully document all versions of the protocol eventually. This site only documents the behaviour of the official client in so much as it informs us about how other clients are expected to behave.
How does the protocol work?
MSN Messenger is a presence and instant messaging system. 'Presence' is whether you're online, whether you're sharing a webcam, etc. 'Instant messaging' is talking with other people. Users of presence and instant messaging systems (people, bots, etc.) are referred to as 'principals'. RFC 2778 provides a very good general overview of what a presence and instant messaging system does, and you're advised to read it if you haven't worked on one before. Where possible, technical terms used on this site have been taken from that document.
An MSN Messenger session involves a connection to a 'Notification Server' (or 'NS'), which provides a presence service. The notification server allows you to connect to 'Switchboard Servers' ('SBs'), which provide an instant messaging service.
Notification Server (NS)
The connection to a notification server is the basis of an MSN Messenger session, as it handles your presence information: if you are disconnected from the notification server, you are no longer online to your buddies. The main purpose of the notification server is to handle presence information about yourself and the principals whose presence you've subscribed to.
The notification server also performs some other services like notifying you about new e-mail in your Hotmail inbox and letting you create new (or join existing) switchboard sessions. When you're directed to join a switchboard session, you should open a new connection to the switchboard, and keep the notification server open.
Note: The original draft refers to a third type of server known as a 'Dispatch Server', or 'DS'. However, throughout our documentation, the Dispatch Server is just treated as the default notification server.
The switchboard handles instant messaging sessions between principals. In other words, each person in an MSN chat corresponds to a connection to a shared switchboard session. Being in two conversations at once means connecting to two switchboard servers at once. Directly connected conversations between principals are not used in MSN Messenger, and the switchboard acts as a proxy between you and those you are chatting with.
A switchboard session can have as many people in it as you like - there's no equivalent of the one-to-one conversations that there's no way of forcing a session not to accept more than two people. This can be quite awkward because some of the uses for a switchboard session (like initiating a file transfer)
The SB is also where invitations to other services such as file transfer and NetMeeting are sent and received. Mobile paging is one of the only forms of communication that does not take place over a switchboard server.
Note that the SB and the NS are not very tightly integrated. For example, when a principal in a switchboard session change his or her display name, the switchboard still sends out messages and other commands with the old display name. In addition, when a principal disconnects from the NS, all switchboard sessions still remain open until the client explicitly closes them.