private void CreateSocket(string hash) { // TODO: FileMode.CreateNew should be used when resume works var fileStream = new FileStream(Destination, FileMode.Create); Socket = new BinarySecureSocket(); Socket.DataReceivedDoneEvent += OnDataReceivedDone; Socket.Connect(Model.ConnectionManager.CurrentBookmark.Transfer, fileStream, ((File) Source).Size, Offset); Debug.WriteLine("MODEL:FileTransfer -> CreateSocket: Starting transfer '" + Source.Name + "' ID '" + hash + "'"); Socket.SendMessage("TRANSFER" + Utility.SP + hash); Socket.Interval += OnInterval; }
/// <summary>Should only give out this once.</summary> /// <returns>A BinarySecureSocket</returns> private BinarySecureSocket GetFileTransferSocket() { if (binarySocket == null) { binarySocket = new BinarySecureSocket(); } return binarySocket; }