DotMSN |

# P2PMessageSession.SendMessage Method

Sends incoming p2p messages to the remote contact.

[Visual Basic]
NotOverridable Public Sub SendMessage( _
ByVal message As NetworkMessage _
) _
Implements IMessageProcessor.SendMessage
[C#]
public void SendMessage(
NetworkMessage message
);

#### Parameters

message
  The P2PMessage to send to the remote contact.

#### Implements

IMessageProcessor.SendMessage

#### Remarks

Before the message is send a couple of things are checked. If there is no identifier available, the local identifier will be increased by one and set as the message identifier. Second, if the acknowledgement identifier is not set it will be set to a random value. After this the method will check for the total length of the message. If the total length is too large, the message will be splitted into multiple messages. The maximum size for p2p messages over a switchboard is 1202 bytes. The maximum size for p2p messages over a direct connection is 1352 bytes. As a result the length of the splitted messages will be 1202 or 1352 bytes or smaller, depending on the availability of a direct connection. If a direct connection is available the message is wrapped in a P2PDCMessage object and send over the direct connection. Otherwise it will be send over a switchboard session. If there is no switchboard session available, or it has become invalid, a new switchboard session will be requested by asking this to the nameserver handler. Messages will be buffered until a switchboard session, or a direct connection, becomes available. Upon a new connection the buffered messages are directly send to the remote contact over the new connection.

#### See Also

P2PMessageSession Class | XihSolutions.DotMSN.DataTransfer Namespace