🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #71821

Re: NNTP posting headers...

#71821
From: John Smith
Date: Sat, 11 Jun 2005 03:58
127 lines
3907 bytes
hlwU:

Yes, here is a snippet which I am am using to try to debug this sending 
of the posting headers--it ain't pretty at this point--the file it reads 
the headers from will follow the code, at the bottom of this post.
// CODE FOLLOWS
#include <windows.h>
#include <winsock2.h>
#include <stdio.h>
#include <string.h>
#include <conio.h>

   WNDCLASS a;
   HWND b;
   MSG c;
   int d;
   char aa[100];
   char bb[100];
   WSAData ws;
   SOCKET s;
   struct sockaddr_in A;
   int i, ii, ch;
   long gg;
   char cc[10000];
   struct hostent *h;
   char p[] = {'P', 'O', 'S', 'T', 13, 10};
   char crlf[] = {13, 10, 0};
   char end[] = {13,10, '.', 13, 10, 0};
   char q[] = {'Q', 'U', 'I', 'T', 13, 10, 0};
   char head[] = {'H', 'E', 'A', 'D', 13, 10};

void getsocket(void);
int snd(char* str);
void list(void);
int rcv(void);
void debug(char*);

void write()
   {
   FILE *f;
   char s[1024];
   int ctr;

   f = fopen("head.txt", "r");
   snd(p);
   rcv();
   while(!feof(f))
      {
      fgets(s, 1024, f);
      s[(strlen(s) - 1)] = 0;
      strcat(s, "\r\n");
      snd(s);
      printf(".%s", s);
      }
   snd(end);
   rcv();
   fclose(f);
   }


void main(void)
   {
   getsocket();
   rcv();
   write();
   ch = getch();
   }

void getsocket(void)
   {
   long gg;

   gg = WSAStartup(0x0101,&ws);
   printf("WSAStartup = %ld\n",gg);
   s = socket(AF_INET,SOCK_STREAM,0);
   printf("socket s = %ld\n",s);
   A.sin_family = AF_INET;
   A.sin_port = htons(119);
   h = gethostbyname("news.excelonline.com");
   printf("%s..\n",h->h_name);
   A.sin_addr.s_addr = *(unsigned long *)h->h_addr_list[0];
   d = connect(s,(struct sockaddr *)&A,sizeof(A));
   printf("In Connect d = %ld\n",d);
   }

int snd(char* str)
   {
   return(send(s, str, strlen(str), 0));
   }

int rcv(void)
   {
   ii = recv(s, cc, sizeof(cc), 0);
   cc[ii] = '\0';
   printf(cc);
   return(ii);
   }

void debug(char* s)
   {
   int ctr;

   ctr = 0;
   while(s[ctr] != (char)0)
      {
      if(s[ctr] < 14)
         printf("%d-", s[ctr++]);
      else
         printf("%c", s[ctr++]);
      }
   printf("\n");
   }

|||||||| header data file (and msg) below |||||
From: assemblywizard@gmail.com (assembly wizard)
Path: com!gmail!assemblywizard
Newsgroups: alt.test.testing
Subject: newest test
Message-ID: <999@gmail.com>
Date: Fri, 19 Nov 82 16:14:55 GMT
Organization: w.w.o.c.w.

This is the message...

..

Technical Details
Message-ID: <7ktqe.4456$JY7.5146668@news.sisna.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20140818.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!prodigy.net!news-feed01.roc.ny.frontiernet.net!nntp.frontiernet.net!news.sisna.com!not-for-mail
References: <W%pqe.2023$Q_3.4102173@news.sisna.com> <874qc53ex8.fsf@windlord.stanford.edu> <NSqqe.2929$DA5.4616216@news.sisna.com> <1118460352.bdf9cb8e357df309ac11eda932577499@teranews>

Show Full Headers
Complete Article Headers
Message-ID: <7ktqe.4456$JY7.5146668@news.sisna.com>
Subject: Re: NNTP posting headers...
Date: Fri, 10 Jun 2005 20:58:57 -0700
From: "John Smith" <assemblywizard@gmail.com>
References: <W%pqe.2023$Q_3.4102173@news.sisna.com> <874qc53ex8.fsf@windlord.stanford.edu> <NSqqe.2929$DA5.4616216@news.sisna.com> <1118460352.bdf9cb8e357df309ac11eda932577499@teranews>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20140818.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!prodigy.net!news-feed01.roc.ny.frontiernet.net!nntp.frontiernet.net!news.sisna.com!not-for-mail
Reply-To: "John Smith" <assemblywizard@gmail.com>
Newsgroups: news.software.nntp
Lines: 127
Organization: W.W.O.C.W.
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 66.81.44.99
X-Complaints-To: newsabuse@ikano.com
X-Trace: news.sisna.com 1118462339 66.81.44.99 (Fri, 10 Jun 2005 21:58:59 MDT)
NNTP-Posting-Date: Fri, 10 Jun 2005 21:58:59 MDT
X-Received-Date: Fri, 10 Jun 2005 21:58:59 MDT (news.sisna.com)