Article View: news.software.nntp
Article #5036Programming my first newsreader and cannot get connected..... please help
From: siggson
Date: Sat, 17 Feb 1996 00:00
Date: Sat, 17 Feb 1996 00:00
69 lines
2634 bytes
2634 bytes
I took the following "working" finger program out of the book intitled
Internet Programming........
if (WSAStartup(WINSOCK_VERSION, &wsaData))
MessageBox(NULL, "Could not load Windows Sockets DLL.",
PROG_NAME, MB_OK|MB_ICONSTOP);
else // Resolve the host name
{
lpHostEnt = gethostbyname(HOST_NAME);
if (!lpHostEnt)
MessageBox(NULL, "Could not get IP address!", HOST_NAME,
MB_OK|MB_ICONSTOP);
else // Create the socket
{
nSocket = socket(PF_INET, SOCK_STREAM, DEFAULT_PROTOCOL);
if (nSocket == INVALID_SOCKET)
MessageBox(NULL, "Invalid socket!!", PROG_NAME,
MB_OK|MB_ICONSTOP);
else // Configure the socket
{
// Get the finger service information
lpServEnt = getservbyname("finger", NULL);
if (lpServEnt == NULL)
iFingerPort = htons(IPPORT_FINGER); //Use the well-known port
else
iFingerPort = lpServEnt->s_port;
// Define the socket address
sockAddr.sin_family = AF_INET; // Internet address family
sockAddr.sin_port = iFingerPort;
sockAddr.sin_addr = *((LPIN_ADDR)*lpHostEnt->h_addr_list);
// Connect the socket
nConnect = connect(nSocket, (LPSOCKADDR) &sockAddr,
sizeof(sockAddr));
if (nConnect)
MessageBox(NULL, "Error connecting socket!!", PROG_NAME,
MB_OK|MB_ICONSTOP);
else // Format and send the finger query
{
.
.
.
.
.
code if connect is OK
why do I get a connect failure when I change the "finger" string to
"nntp". Should I be able to connect to port 119 this way? Thanks for
the help.
Technical Details
Message-ID:
<31257988.5156441@news.netvoyage.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <31257988.5156441@news.netvoyage.net> Subject: Programming my first newsreader and cannot get connected..... please help Date: Sat, 17 Feb 1996 00:00:00 +0000 From: siggson@netvoyage.net Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 139690302 Organization: Netvoyage Internet Access Provider Newsgroups: news.software.nntp