How to "stutter" incoming stream? - BSD

This is a discussion on How to "stutter" incoming stream? - BSD ; How do I adjust the rate at which I receive TCP/IP data? I want spamd to stutter not just on the transmission of data, but I want it to present a "slow" stream on incoming data as well, under program ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: How to "stutter" incoming stream?

  1. How to "stutter" incoming stream?

    How do I adjust the rate at which I receive TCP/IP data?

    I want spamd to stutter not just on the transmission of data, but
    I want it to present a "slow" stream on incoming data as well,
    under program control.

    The scenario is that the spammer has identified themselves for
    special treatment, and when they send the SMTP "DATA" command
    I want them to suddenly behave as if I'm only connect to the
    internet via a 300 baud modem instead of ADSL.

    Is such a thing possible? I just need a push in the right
    direction; is setsockopt(2) the way to do this, or is there
    a different / better way?

    I don't want to slow *all* incoming streams, just select ones,
    and only after some amount of data has passed through at a
    high rate.

    Thanks in advance for your help!

    Cheers,
    -RK
    --
    Robert Krten, Antique computer collector looking for PDP-8 and PDP-8/S
    minicomputers; check out their "good home" at www.parse.com/~museum

  2. Re: How to "stutter" incoming stream?

    Peter N. M. Hansteen wrote:
    > info2007@parse.com (Robert Krten) writes:


    > > The scenario is that the spammer has identified themselves for
    > > special treatment, and when they send the SMTP "DATA" command
    > > I want them to suddenly behave as if I'm only connect to the
    > > internet via a 300 baud modem instead of ADSL.


    > for that specific scenario, adjusting spamd's -s option to something
    > higher than the default 1 second is the easy way. with really naive
    > spambots, if you increase the -s value to 10, they'll hang around ten
    > times longer (like 4352 seconds instead of just the regular 435)


    As I understand it, that (-s) is the *outgoing* stutter -- once they
    say "DATA" and spamd has said "ok, go ahead and send", the spammer will
    send their entire spam message at ADSL speed; I want them to be choked
    down to 300 baud so that each character of spam they send takes a long
    time to arrive...

    Am I being clearer now? :-)

    Cheers,
    -RK
    --
    Robert Krten, Antique computer collector looking for PDP-8 and PDP-8/S
    minicomputers; check out their "good home" at www.parse.com/~museum

  3. Re: How to "stutter" incoming stream?

    On Fri, 23 Nov 2007 12:10:20 +0000, Robert Krten wrote:

    > As I understand it, that (-s) is the *outgoing* stutter -- once they
    > say "DATA" and spamd has said "ok, go ahead and send", the spammer will
    > send their entire spam message at ADSL speed; I want them to be choked
    > down to 300 baud so that each character of spam they send takes a long
    > time to arrive...


    Look at spamd's -w option

    -w window
    Set the socket receive buffer to this many bytes, adjusting the
    window size.

    This is done using setsockopt(2) SO_RCVBUF. If your receive buffer is
    only one character, the peer can only send a single character, then has
    to wait until your program reads that. Your program can wait a couple
    of seconds between reads, slowing the flow to X bytes per second.

    Daniel

  4. Re: How to "stutter" incoming stream?

    Daniel Hartmeier wrote:
    > On Fri, 23 Nov 2007 12:10:20 +0000, Robert Krten wrote:


    > > As I understand it, that (-s) is the *outgoing* stutter -- once they
    > > say "DATA" and spamd has said "ok, go ahead and send", the spammer will
    > > send their entire spam message at ADSL speed; I want them to be choked
    > > down to 300 baud so that each character of spam they send takes a long
    > > time to arrive...


    > Look at spamd's -w option


    > -w window
    > Set the socket receive buffer to this many bytes, adjusting the
    > window size.


    > This is done using setsockopt(2) SO_RCVBUF. If your receive buffer is
    > only one character, the peer can only send a single character, then has
    > to wait until your program reads that. Your program can wait a couple
    > of seconds between reads, slowing the flow to X bytes per second.


    Sweet, so that's what that does :-)

    Thanks Daniel!

    Cheers,
    -RK
    --
    Robert Krten, Antique computer collector looking for PDP-8 and PDP-8/S
    minicomputers; check out their "good home" at www.parse.com/~museum

+ Reply to Thread