|
|
1.1 ! root 1: /* rfsend.c - rfsend */ ! 2: ! 3: #include <conf.h> ! 4: #include <kernel.h> ! 5: #include <network.h> ! 6: ! 7: /*------------------------------------------------------------------------ ! 8: * rfsend -- send message to remote server and await reply ! 9: *------------------------------------------------------------------------ ! 10: */ ! 11: rfsend(fptr, reqlen, rplylen) ! 12: struct fphdr *fptr; ! 13: int reqlen; ! 14: int rplylen; ! 15: { ! 16: int trys; ! 17: int ret; ! 18: PStype ps; ! 19: ! 20: /* Clear server queue, and send packet to it */ ! 21: ! 22: if (Rf.device == RCLOSED) { ! 23: Rf.device = open(INTERNET, RSERVER, ANYLPORT); ! 24: if (Rf.device == SYSERR || ! 25: control(Rf.device, DG_SETMODE, DG_DMODE|DG_TMODE) ! 26: == SYSERR) ! 27: return(SYSERR); ! 28: } ! 29: disable(ps); ! 30: control(Rf.device, DG_CLEAR); ! 31: for (trys=0 ; trys<RMAXTRY ; trys++) { ! 32: if ( write(Rf.device, fptr, reqlen) ! 33: == SYSERR) { ! 34: restore(ps); ! 35: return(SYSERR); ! 36: } ! 37: if ( (ret=read(Rf.device, fptr, rplylen) ) ! 38: !=SYSERR && ret != TIMEOUT) { ! 39: restore(ps); ! 40: return(ret); ! 41: } ! 42: } ! 43: restore(ps); ! 44: return(SYSERR); ! 45: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.