internal void Reset() { this.receivedPrefixBytesDoneCount = 0; this.receivedMessageBytesDoneCount = 0; this.recPrefixBytesDoneThisOp = 0; this.receiveMessageOffset = this.PermanentReceiveMessageOffset; this._dataMode = P2PDataSendMode.notDefined; }
public P2PPortClientConnectionHandler(SocketAsyncEventArgs e, Int32 rOffset, Int32 sOffset, Int32 receivePrefixLength, Int32 sendPrefixLength) { this._handlerID = UtilitiesModule.GetIndexableGUID(); this.BufferOffsetReceive = rOffset; this.BufferOffsetSend = sOffset; this.receivePrefixLength = receivePrefixLength; this.sendPrefixLength = sendPrefixLength; this.receiveMessageOffset = rOffset + receivePrefixLength; this.PermanentReceiveMessageOffset = this.receiveMessageOffset; this._dataMode = P2PDataSendMode.notDefined; }
public void SendData(P2PDataSendMode mode, P2PData data) { switch (mode) { case P2PDataSendMode.SyncrhonicalSend: //sends data to the remote port and waits intil the remote port returns a operation //result try { this.SendDataInSynchronicalMode(data); } catch (Exception ex) { throw (ex); } try { if (SuccesfullyDataSentEvent != null) { SuccesfullyDataSentEvent(data); } } catch (Exception) { } break; case P2PDataSendMode.AsynchronycalSend: //this method send data to the P2PPort without waiting a callback or a result from the remote port this.SendDataInAsynchronicalMode(data); try { if (SuccesfullyDataSentEvent != null) { SuccesfullyDataSentEvent(data); } } catch (Exception) { } break; } }