public Form1() { InitializeComponent(); _smb = new SMB(); string hostname = Environment.MachineName + "-MTP"; linkLabel1.Text = string.Format(@"\\{0}\mtpdevices", hostname); _smb.Start(hostname, 16384, NetFlag.ListenAllNetworkCards, 8, ""); }
//That is the main part of the program private void startCIFSServer() { // Check if the server is already running if (RunAlready()) { Trace.WriteLine("Fatal->The server is already running, this instance is beeing stopped."); throw new ApplicationException("Server must only run in one instance."); } const int SMBNameLength = 15; // Start SMB server try { string HostName = System.Windows.Forms.SystemInformation.ComputerName.ToUpper(); if (HostName.Length > SMBNameLength) { HostName = HostName.Substring(0, SMBNameLength); } string ServerName = "iPhoneDrive"; // oder fester Name string DomainController = string.Empty; // Name of the domain controller, is used for validating users, set it null to accept everybody CIFS = new SMB(); CIFS.Start( ServerName, (ushort)16384, NetFlag.Announce | NetFlag.RemoteAccess | NetFlag.ListenAllNetworkCards, 5, // Anzahl der gleichzeitigen Anfragen DomainController); } catch (Exception ex) { throw new ApplicationException("CIFS server could not be started.", ex); } }