🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
2 messages
2 total messages Started by siggson Sat, 17 Feb 1996 00:00
Programming my first newsreader and having a baseic problem....help
#19288
Author: siggson
Date: Sat, 17 Feb 1996 00:00
72 lines
2646 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.




Re: Programming my first newsreader and having a baseic problem....help
#19331
Author: Tim Pierce
Date: Sun, 18 Feb 1996 00:00
23 lines
1608 bytes
In article <312648ca.900847@news.netvoyage.net>,
 <siggson@netvoyage.net> wrote:

>I took the following "working" finger program out of the book intitled
>Internet Programming........

And it's a Windows program.  Describing your platform is a good
idea right off the top.

>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?

If the remote host is running a news server and is willing to
accept connections from your machine, probably.  You don't
indicate whether you've checked that condition, or what host
you're trying to connect to.

-- 
By sending unsolicited commercially-oriented e-mail to this address, the 
sender agrees to pay a $100 flat fee to the recipient for proofreading 
services.

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