// PupTestEFTP.bcpl - Pup package test program // Copyright Xerox Corporation 1979, 1982 // Last modified February 15, 1982 5:28 PM by Boggs get "PupEFTP.decl" get "PupTest.decl" external [ //outgoing procedures EFTPReceive; EFTPSend //incoming procedures GetString; GetPartner Zero; MoveBlock; BlockEq; Block Puts; Endofs; Free; Allocate SetAllocation; ComputeThruput OpenPort; PutTemplate; Ws; Wss OpenEFTPSoc; CloseEFTPSoc; SendEFTPEnd SendEFTPBlock; ReceiveEFTPBlock //incoming statics State; Cmmd; checksums; checkdata keys; dsp; sysZone; pbiCount checkBuffer; sendPort; tp ] manifest realTimeClock = 430b //---------------------------------------------------------------------------- let EFTPReceive() be //a context //---------------------------------------------------------------------------- [ let inBuffer = Allocate(sysZone, 256) let soc = vec lenEFTPSoc [ OpenEFTPSoc(soc, table [ 0; 0; socketEFTPReceive ], 0) let total = pbiCount/2 SetAllocation(soc, total, total-1, total-1) soc>>PupSoc.doChecksum = checksums while ReceiveEFTPBlock(soc, inBuffer, 512, -1) eq 512 do if checkdata then unless BlockEq(checkBuffer, inBuffer, 256) do [ Ws("*NRcvr Data Compare Error."); break ] CloseEFTPSoc(soc) ] repeat ] //---------------------------------------------------------------------------- and EFTPSend() be //---------------------------------------------------------------------------- [ Ws("EFTP Send. ") let soc = vec lenEFTPSoc test Cmmd eq 0 ifso [ let name = vec 40 unless GetString("Receive Port: ", name, true, false) return if GetPartner(name, dsp, sendPort, 0, socketEFTPReceive) break ] repeat ifnot [ sendPort>>Port.socket^1 = 0 sendPort>>Port.socket^2 = socketEFTPReceive ] OpenEFTPSoc(soc, 0, sendPort) let total = pbiCount/2 SetAllocation(soc, total, total-1, total-1) Ws("- Checksums "); Ws(checksums ? "enabled.*N", "disabled.*N") soc>>PupSoc.doChecksum = checksums test SendEFTPBlock(soc, checkBuffer, 512, 12000) eq 512 ifso Ws("Connection open. '!' = 10,000 bytes*N") ifnot [ Ws("Failed."); CloseEFTPSoc(soc); return ] State = stateEFTP Zero(tp, lenTP) tp>>TP.timer = @realTimeClock [ if SendEFTPBlock(soc, checkBuffer, 512, 12000) ne 512 then [ Ws("*NSendEFTPBlock Failed"); break ] tp>>TP.count = tp>>TP.count + 512 if tp>>TP.count ge 10000 then [ tp>>TP.count = tp>>TP.count - 10000 Puts(dsp,$!) tp>>TP.bigCount = tp>>TP.bigCount+1 if tp>>TP.bigCount eq 50 then //500,000 bytes [ ComputeThruput(tp) tp>>TP.bigCount = 0 tp>>TP.timer = @realTimeClock ] ] ] repeatwhile Endofs(keys) & Cmmd eq 0 test SendEFTPEnd(soc, 3000) ifso Ws("*NClosed cleanly") ifnot Ws("*NClosed uncleanly") CloseEFTPSoc(soc) ]