Beispiel #1
0
        void oper(Opcodes oper, string srvip, int srvport, string remoteFile, string localFile, Modes tftpmode)
        {
            byte[] buf;
            ss     s = ss.get_clnt_session(localFile, remoteFile, oper, tftpmode, log, new IPEndPoint(IPAddress.Parse(srvip), srvport), opts);

            s.pkt_proc(null);
            while (true)
            {
                try
                {
                    buf = s.uc.Receive(ref s.r);   // change remote port automatically
                    if (!s.pkt_proc(buf))
                    {
                        break;
                    }
                }
                catch (Exception)
                {
                    if (!s.retry())
                    {
                        break;
                    }
                }
                s.progress_display();
            }
            s.session_display();
            s.destroy();
        }
Beispiel #2
0
        void session_handler(byte[] buf, IPEndPoint r)
        {
            ss s = ss.get_srv_session(log, buf, r, opts);

            if (s.pkt_proc(buf))
            {
                while (true)
                {
                    try
                    {
                        buf = s.uc.Receive(ref r);
                        if (!s.pkt_proc(buf))
                        {
                            break;
                        }
                    }
                    catch (Exception)
                    {
                        if (!s.retry())
                        {
                            break;
                        }
                        //slog("I: retransmit block " + s.blkno + " pkt blkno " + (s.blkno & 0xffff));
                    }
                    s.progress_display();
                }
            }
            s.session_display();
            s.destroy();
            if (sshash.ContainsKey(r))
            {
                sshash.Remove(r);
            }
        }