🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: demon.ip.developers
Article #648

Re: Ka9q, how to close socket?

#648
From: Graham E Kinns
Date: Wed, 08 Jan 1997 00:00
42 lines
2187 bytes
John Washington <john@wash.demon.co.uk> wrote:
>Now I sometimes want to abandon the transfer early.
>(Specifically, if conditions such as 'Last-Modified'
>in the header show I already have the file in question).
>How do I do that?  Is it as simple as issuing 'close_s'
>as I already do when the other end closed first?
>Or what?  If someone can point me at other parts of
>ka9q that do this, that would be fine.

close_s (s) only closes your outgoing data stream.
shutdown (s, 2) will reset (abort) the connection (see the comments in 
the source ;-))  It's used in ftpcli.c, ftpserv.c, smtpserv.c, 
session.c, ...

How about sending an If-Modified-Since: header instead?

>Talking of 'Last-Modified', is that described in an
>RFC somewhere?  Seems like it's followed by a date/time
>in a fairly standard format, but I'm curious to know
>how much the format can vary.

RFC1945

>Of course I wish to compare that date with a local
>file date/time within DOS (getfdatetime) -- are there
>any existing functions for converting a date string
>to something more computer-friendly (reverse of
>asctime or strftime) either in ka9q or BC 3.1, or,
>well, anywhere?

If you use fstat() (not stat() 'cause it's unstable with KA9Q) 
instead, it'll handle the timezone conversion so you get the 
file's timestamp already GMT based.

I would have looked at the source for Apache, for example, as a 
starting point but since I've already got Borland compatible code to
convert a NewNews style timestamp to a time_t, I'll have a fiddle ...

Cheers, Graham.
-- 
----[ Graham E. Kinns ]----==========----< Graham@grempc.demon.co.uk >----
Technical Details
Message-ID: <852752397snz.6764@grempc.demon.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <852574503snz@wash.demon.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10bb05,e7fd7dfc60d2b809,start
X-Google-Attributes: gid10bb05,public
From: Graham@grempc.demon.co.uk (Graham E Kinns)
Subject: Re: Ka9q, how to close socket?
Date: 1997/01/08
Message-ID: <852752397snz.6764@grempc.demon.co.uk>
X-Deja-AN: 208538138
x-nntp-posting-date: Wed, 08 Jan 1997 23:25:32 +0000 (GMT)
x-nntp-posting-host: grempc.demon.co.uk
references: <852574503snz@wash.demon.co.uk>
organization: Home, N Yorks, UK
newsgroups: demon.ip.developers