Article View: news.software.nntp
Article #71829Re: NNTP posting headers...
From: John Smith
Date: Sat, 11 Jun 2005 16:46
Date: Sat, 11 Jun 2005 16:46
129 lines
4330 bytes
4330 bytes
yes, there was and still is, however, I had to make it work to be able
to revamp it... now I can work on the way I wish to construct the
strings...
... this code is able to conduct a post...
#include <windows.h>
#include <winsock2.h>
#include <stdio.h>
#include <string.h>
#include <conio.h>
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};
char end[] = {13,10, '.', 13, 10};
void getsocket(void);
int snd(char* str);
int rcv(void);
void help(void);
void write(void)
{
FILE *f;
f = fopen("h.txt", "r");
while(!feof(f))
{
fgets(cc, 10000, f);
cc[(strlen(cc) - 1)] = 0;
strcat(cc, "\r\n");
snd(cc);
printf(cc);
}
snd("\r\n.\r\n");
rcv();
fclose(f);
}
void ihave(void)
{
memset(cc, 0, 10000);
sprintf(cc, "IHAVE 2345@gmail.com togo.com%c%c", (char)13, (char)10);
snd(cc);
rcv();
}
void main(void)
{
getsocket();
rcv();
// ihave();
help();
/*
memset(cc, 0, 10000);
sprintf(cc, "POST%c%c", (char)13, (char)10);
snd(cc);
rcv();
write();
*/
}
void getsocket(void)
{
long gg;
int d;
gg = WSAStartup(0x0101,&ws);
s = socket(AF_INET,SOCK_STREAM,0);
A.sin_family = AF_INET;
A.sin_port = htons(119);
h = gethostbyname("news.excelonline.com");
A.sin_addr.s_addr = *(unsigned long *)h->h_addr_list[0];
d = connect(s,(struct sockaddr *)&A,sizeof(A));
}
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 help(void)
{
memset(cc, 0, 10000);
sprintf(cc, "HELP\r\n");
snd(cc);
rcv();
}
John
"Szymon Sokól" <szymon@bastard.operator.from.hell.pl> wrote in message
news:d8esac$g62$2@galaxy.uci.agh.edu.pl...
> Urs Janßen <urs@akk.org> wrote:
>> In <Xqyqe.5156$LF3.6872124@news.sisna.com>, John Smith wrote:
>> \0 terminte _all_ you strings:
>
>> > char p[] = {'P', 'O', 'S', 'T', 13, 10};
>
> Is there any reason not to write it as:
> char p[] = "POST\r\n";
> ?
> More readable *and* ensures null-termination.
>
> --
> Szymon Sokó³ (SS316-RIPE) -- Network Manager
> B
> Computer Center, AGH - University of Science and Technology, Cracow,
> Poland O
> http://home.agh.edu.pl/szymon/ PGP key id: RSA: 0x2ABE016B, DSS:
> 0xF9289982 F
> Free speech includes the right not to listen, if not interested --
> Heinlein H
Technical Details
Message-ID:
<7AEqe.5170$CN1.8007728@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!nntp.giganews.com!newscon06.news.prodigy.com!prodigy.net!news-feed01.roc.ny.frontiernet.net!nntp.frontiernet.net!news.sisna.com!not-for-mailReferences:
<W%pqe.2023$Q_3.4102173@news.sisna.com> <874qc53ex8.fsf@windlord.stanford.edu> <NSqqe.2929$DA5.4616216@news.sisna.com> <1118460352.bdf9cb8e357df309ac11eda932577499@teranews> <7ktqe.4456$JY7.5146668@news.sisna.com> <Zmtqe.4477$V_7.5198016@news.sisna.com> <d8e428$nam$1@galaxy.uci.agh.edu.pl> <swwqe.5149$292.6379588@news.sisna.com> <Xqyqe.5156$LF3.6872124@news.sisna.com> <d8edt8$4p2$1@news2.rz.uni-karlsruhe.de> <d8esac$g62$2@galaxy.uci.agh.edu.pl>Show Full Headers
Complete Article Headers
Message-ID: <7AEqe.5170$CN1.8007728@news.sisna.com> Subject: Re: NNTP posting headers... Date: Sat, 11 Jun 2005 09:46: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> <7ktqe.4456$JY7.5146668@news.sisna.com> <Zmtqe.4477$V_7.5198016@news.sisna.com> <d8e428$nam$1@galaxy.uci.agh.edu.pl> <swwqe.5149$292.6379588@news.sisna.com> <Xqyqe.5156$LF3.6872124@news.sisna.com> <d8edt8$4p2$1@news2.rz.uni-karlsruhe.de> <d8esac$g62$2@galaxy.uci.agh.edu.pl> 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!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: 129 Organization: W.W.O.C.W. X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 NNTP-Posting-Host: 66.81.61.144 X-Complaints-To: newsabuse@ikano.com X-Trace: news.sisna.com 1118508419 66.81.61.144 (Sat, 11 Jun 2005 10:46:59 MDT) NNTP-Posting-Date: Sat, 11 Jun 2005 10:46:59 MDT X-Received-Date: Sat, 11 Jun 2005 10:46:59 MDT (news.sisna.com)