DotMSN |

# P2PMessageSession Methods

The methods of the P2PMessageSession class are listed below. For a complete list of P2PMessageSession class members, see the P2PMessageSession Members topic.

#### Public Instance Methods

AbortAllTransfers | Aborts all running transfer sessions.
AddTransferSession | Adds the specified transfer session to the collection and sets the transfer session's message processor to be the message processor of the p2p message session. This is usally a SB message processor.
CleanUp | Removes references to handlers and the messageprocessor. Also closes running transfer sessions and pending processors establishing connections.
CloseDirectConnection | Closes the direct connection with the remote client, if available. A closing p2p message will be send first. The session will fallback to the previous (SB) message processor.
CorrectLocalIdentifier | Corrects the local identifier with the specified correction.
CreateDirectConnection | Creates a direct connection with the remote client.
Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHandler | Searches through all handlers and returns the first object with the specified type, or null if not found.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type. GetHashCode is suitable for use in hashing algorithms and data structures like a hash table.
GetTransferSession | Returns the transfer session associated with the specified session identifier.
GetType (inherited from Object) | Gets the Type of the current instance.
HandleMessage | Handles P2PMessages. Other messages are ignored. All incoming messages are supposed to belong to this session.
IncreaseLocalIdentifier | The identifier of the local client, increases with each message send
IncreaseRemoteIdentifier | The identifier of the remote client, increases with each message received
ListenForDirectConnection | Setups a P2PDirectProcessor to listen for incoming connections. After a connection has been established the P2PDirectProcessor will become the main MessageProcessor to send messages.
RegisterHandler | Registers a message handler. After registering the handler will receive incoming messages.
RemoveTransferSession | Removes the specified transfer session from the collection.
SendMessage | Sends incoming p2p messages to the remote contact.
ToString (inherited from Object) | Returns a String that represents the current Object.
UnregisterHandler | Unregisters a message handler. After registering the handler will no longer receive incoming messages.

#### Protected Instance Methods

AddPendingProcessor | Add the processor to the pending list.
BufferMessage | Buffer messages that can not be send because of an invalid message processor.
Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
InvalidateProcessor | Sets the processor as invalid, and requests the p2phandler for a new request.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.
OnHandshakeCompleted | Occurs when an acknowledgement to a send handshake has been received, or a handshake is received. This will start the data transfer, provided the local client is the sender.
OnProcessorInvalid | Fires the ProcessorInvalid event.
SendBuffer | Try to resend any messages that were stored in the buffer.
SendHandshakeMessage | Sends the handshake message in a direct connection.
StopAllPendingProcessors | Disconnect all processors that are trying to establish a connection.
UsePendingProcessor | Use the given processor as the direct connection processor. And disconnect all other pending processors.
ValidateProcessor | Sets the processor as valid.
WrapMessage | Wraps a P2PMessage in a MSGMessage and SBMessage.

#### See Also

P2PMessageSession Class | XihSolutions.DotMSN.DataTransfer Namespace