internal DccSend(IrcFeatures irc, string user, IPAddress externalIpAdress, Stream file, string filename, long filesize, DccSpeed speed, bool passive, Priority priority) : base() { this.Irc = irc; _DirectionUp = true; _File = file; _Filesize = filesize; _Filename = filename; _Speed = speed; User = user; if(passive) { irc.SendMessage(SendType.CtcpRequest, user, "DCC SEND \"" + filename + "\" " + HostToDccInt(externalIpAdress).ToString() + " 0 " + filesize + " " + session, priority); } else { DccServer = new TcpListener(new IPEndPoint(IPAddress.Any, 0)); DccServer.Start(); LocalEndPoint = (IPEndPoint)DccServer.LocalEndpoint; irc.SendMessage(SendType.CtcpRequest, user, "DCC SEND \"" + filename + "\" " + HostToDccInt(externalIpAdress).ToString() + " " + LocalEndPoint.Port + " " + filesize, priority); } }
internal DccSend(IrcFeatures irc, string user, IPAddress externalIpAdress, Stream file, string filename, long filesize, DccSpeed speed, bool passive, Priority priority) { Irc = irc; _DirectionUp = true; _File = file; _Filesize = filesize; _Filename = filename; _Speed = speed; User = user; if (passive) { irc.SendMessage(SendType.CtcpRequest, user, "DCC SEND \"" + filename + "\" " + HostToDccInt(externalIpAdress).ToString() + " 0 " + filesize + " " + SessionId, priority); } else { DccServer = new TcpListener(new IPEndPoint(IPAddress.Any, 0)); DccServer.Start(); LocalEndPoint = (IPEndPoint)DccServer.LocalEndpoint; irc.SendMessage(SendType.CtcpRequest, user, "DCC SEND \"" + filename + "\" " + HostToDccInt(externalIpAdress).ToString() + " " + LocalEndPoint.Port + " " + filesize, priority); } }
/// <summary> /// Send any Stream, full flexibility in Dcc Connection Negotiation /// </summary> /// <param name="user">Destination of the File (no channel)</param> /// <param name="file">You can send any stream here</param> /// <param name="filename">give a filename for the remote User</param> /// <param name="filesize">give the length of the stream</param> /// <param name="speed">What ACK Managment should be used</param> /// <param name="passive">Passive DCC</param> /// <param name="priority">Non Dcc Message Priority for Negotiation</param> public void SendFile(string user, Stream file, string filename, long filesize, DccSpeed speed, bool passive, Priority priority) { var send = new DccSend(this, user, ExternalIpAdress, file, filename, filesize, speed, passive, priority); _DccConnections.Add(send); ThreadPool.QueueUserWorkItem(new WaitCallback(send.InitWork)); RemoveInvalidDccConnections(); }
/// <summary> /// Send any Stream, full flexibility in Dcc Connection Negotiation /// </summary> /// <param name="user">Destination of the File (no channel)</param> /// <param name="file">You can send any stream here</param> /// <param name="filename">give a filename for the remote User</param> /// <param name="filesize">give the length of the stream</param> /// <param name="speed">What ACK Managment should be used</param> /// <param name="passive">Passive DCC</param> public void SendFile(string user, Stream file, string filename, long filesize, DccSpeed speed, bool passive) => SendFile(user, file, filename, filesize, speed, passive, Priority.Medium);
/// <summary> /// Send any Stream, full flexibility in Dcc Connection Negotiation /// </summary> /// <param name="user">Destination of the File (no channel)</param> /// <param name="file">You can send any stream here</param> /// <param name="filename">give a filename for the remote User</param> /// <param name="filesize">give the length of the stream</param> /// <param name="speed">What ACK Managment should be used</param> /// <param name="passive">Passive DCC</param> /// <param name="priority">Non Dcc Message Priority for Negotiation</param> public void SendFile(string user, Stream file, string filename, long filesize, DccSpeed speed, bool passive, Priority priority) { DccSend send = new DccSend(this, user, _ExternalIpAdress, file, filename, filesize, speed, passive, priority); _DccConnections.Add(send); ThreadPool.QueueUserWorkItem(new WaitCallback(send.InitWork)); RemoveInvalidDccConnections(); }
/// <summary> /// Send any Stream, full flexibility in Dcc Connection Negotiation /// </summary> /// <param name="user">Destination of the File (no channel)</param> /// <param name="file">You can send any stream here</param> /// <param name="filename">give a filename for the remote User</param> /// <param name="filesize">give the length of the stream</param> /// <param name="speed">What ACK Managment should be used</param> /// <param name="passive">Passive DCC</param> public void SendFile(string user, Stream file, string filename, long filesize, DccSpeed speed, bool passive) { this.SendFile(user, file, filename, filesize, speed, passive, Priority.Medium); }