Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Publicaciones sobre rater

Se busca: programador C

Pa­ra ha­cer que sea real­men­te úti­l, sin em­bar­go, ne­ce­si­to un pro­gra­ma­dor C que con­vier­ta es­te pro­gra­ma py­tho­n:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
from socket import *
serverHost = 'localhost'
serverPort = 1999

s = socket(AF_INET, SOCK_STREAM)
s.connect((serverHost, serverPort))
print "Sending: ",' '.join(sys.argv[1:])
s.send(' '.join(sys.argv[1:])+"\n")
data = s.recv(1024)
sys.stderr.write(data)
sys.stderr.flush()
sys.exit(int(data.split(' ')[0]))

En una lin­da fun­ción que nun­ca fa­lle y nun­ca pier­da me­mo­ria (por su­pues­to de­be re­tor­nar en vez de salir del pro­gra­ma, es­to es un ejem­plo ;-)

Si ten­go eso, pue­do li­be­rar ra­ter co­mo una he­rra­mien­ta úti­l, que de­be­ría en­con­trar un ho­gar en mu­chas ins­ta­la­cio­nes de qmail (y tal vez tam­bién ten­ga otros uso­s)

Rater progresses (slowly)

I am hack­ing a bit on rater my dae­mon/­client to see if things are hap­pen­ing more of­ten than they should (in oth­er word­s, gener­ic rate lim­it­ing).

I had to take a few days of­f, since my broth­er got mar­ried and we all went back to San­ta Fe for that and a week­end, and then ev­ery­one else has sore throats and I am the on­ly one healthy.

But hey, it works well enough al­ready:

  • The sim­­plis­tic pro­­to­­col is done

  • The serv­er works

    • It can take hours of gib­ber­ish with­­­out prob­lem­s.

    • It can take hours of valid in­­­put with­­­out prob­lem­s.

    • It does what it's sup­­­posed to do.

  • It's stay­ing be­low 300S­LOC, which was my goal.

Miss­ing stuff:

  • Val­­grind it.

  • Client li­brary.

  • Gen­er­ic CLI clien­t.

  • A qmail-spp plug­in that us­es it.

And then, I can for­get all about it.


Contents © 2000-2024 Roberto Alsina