/// <summary> /// to start the smbserver, tcp transport. /// </summary> /// <param name="serverAddress">the address of server</param> /// <param name="localPort">the local port to bind for server</param> /// <param name="maxConnections">the max connections of server capability</param> /// <param name="bufferSize">the buffer size of transport </param> /// <param name="accountCredential">the credential to authenticate client, spn is always cifs/machine</param> public virtual void Start(IPAddress serverAddress, int localPort, int maxConnections, int bufferSize, AccountCredential accountCredential) { this.credential = accountCredential; SocketTransportConfig config = new SocketTransportConfig(); config.Type = StackTransportType.Tcp; config.Role = Role.Server; config.LocalIpAddress = serverAddress; config.LocalIpPort = localPort; config.MaxConnections = maxConnections; config.BufferSize = bufferSize; SmbServerDecodePacket decoder = new SmbServerDecodePacket(); decoder.Context = this.context; this.transport = new TransportStack(config, decoder.DecodePacket); this.transport.Start(); this.transportType = TransportType.TCP; }
public virtual void Start( string localNetbiosName, int adapterIndex, int bufferSize, int maxSessions, int maxNames, AccountCredential credential) { if (localNetbiosName == null) { throw new ArgumentNullException("localNetbiosName"); } NetbiosTransportConfig config = new NetbiosTransportConfig(); config.Type = StackTransportType.Netbios; config.Role = Role.Server; config.AdapterIndex = (byte)adapterIndex; config.BufferSize = bufferSize; config.MaxSessions = maxSessions; config.MaxNames = maxNames; config.LocalNetbiosName = localNetbiosName; SmbServerDecodePacket decoder = new SmbServerDecodePacket(); decoder.Context = this.context; this.transport = new TransportStack(config, decoder.DecodePacket); this.transport.Start(); this.transportType = TransportType.NetBIOS; }