/// <summary> /// Release resources. /// </summary> /// <param name = "disposing"> /// If disposing equals true, Managed and unmanaged resources are disposed. if false, Only unmanaged resources /// can be disposed. /// </param> protected virtual void Dispose(bool disposing) { if (!this.disposed) { // If disposing equals true, dispose all managed and unmanaged resources. if (disposing) { // Free managed resources & other reference types: } // Call the appropriate methods to clean up unmanaged resources. // If disposing is false, only the following code is executed: // remote the instance from pool. NetbiosTransportPool.Remove(this); this.disposed = true; } }
/// <summary> /// Constructor /// </summary> /// <param name="localName"> /// a string that specifies the local netbios name.<para/> /// its value is initialized by config.<para/> /// it's used to invoke the netbios command. /// </param> /// <param name="adapterIndex"> /// a byte value that specifies the adapter index.<para/> /// when initialize the transport pool, it's used to set the networkAdapterId. /// </param> /// <param name="maxBufferSize"> /// a ushort value that specifies the max buffer size.<para/> /// its value is initialized by config. /// </param> /// <param name="maxSessionNum"> /// a byte value that specifies the max session number.<para/> /// when initialize the transport pool, it's used to set the adapter. /// </param> /// <param name="maxNames"> /// a byte value that specifies the max names number.<para/> /// when initialize the transport pool, it's used to set the adapter. /// </param> /// <exception cref="ArgumentNullException"> /// throw when localName is null. /// </exception> public NetbiosTransport( string localName, byte adapterIndex, ushort maxBufferSize, byte maxSessionNum, byte maxNames) { if (localName == null) { throw new ArgumentNullException("localName"); } this.localNetbiosName = localName; this.adapterIndex = adapterIndex; this.maxBufferSize = maxBufferSize; this.maxSessionNum = maxSessionNum; this.maxNames = maxNames; this.networkAdapterId = this.GetAdapterId(); NetbiosTransportPool.Initialize(this); }