DotMSN |

# P2PMessageSession Members

P2PMessageSession overview

#### Public Instance Constructors

P2PMessageSession Constructor | Constructor.

#### Public Instance Properties

AutoHandshake | Defines whether a direct connection handshake is automatically send to the remote client, or replied with an acknowledgement. Setting this to true means the remote client will start the transfer immediately. Setting this to false means the client programmer must send a handhsake message and an acknowledgement message after which the transfer will begin.
DirectConnected | Defines whether the message session runs over a direct session or is routed via the messaging server
DirectConnectionAttempt | Defines whether an attempt has been made to create a direct connection
HandshakeMessage | The handshake message to send to the receiving client when a direct connection has been established
LocalBaseIdentifier | The base identifier of the local client
LocalContact | The account of the local contact.
LocalIdentifier | The identifier of the local contact. This identifier is increased just before a message is send.
MessageProcessor | The message processor that sends the P2P messages to the remote contact.
ProcessorValid | Indicates whether the processor is invalid
RemoteBaseIdentifier | The base identifier of the remote client
RemoteContact | The account of the remote contact.
RemoteIdentifier | The expected identifier of the remote client for the next message.

#### 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.

#### Public Instance Events

DirectConnectionEstablished | Occurs when a direct connection is succesfully established.
DirectConnectionFailed | Occurs when a direct connection attempt has failed.
ProcessorInvalid | Occurs when the processor has been marked as invalid. Due to connection error, or message processor being null.

#### Protected Instance Properties

P2PMessagePool | Keeps track of clustered p2p 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