Thread View: news.software.readers
1 messages
1 total messages
Started by siggson
Sat, 17 Feb 1996 00:00
Programming my fist newsreader and having problems connecting.... Please help
Author: siggson
Date: Sat, 17 Feb 1996 00:00
Date: Sat, 17 Feb 1996 00:00
72 lines
2657 bytes
2657 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.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads