NNTP client problem (BSD Sockets)
- From: Niz <niz@xxxxxxxxxxx>
- Date: Sun, 16 Mar 2008 18:09:56 +0000
Okay I'm having some problems with an NNTP client I am trying to write. I have sent the username after recieving the requires authentification command, but the program hangs on recv().
Basically I'm meant to recv a command saying that the server requires a password as to be expected. I know that I have sent the username command correctly as the send() command has returned the correct number but the server just does not respond.
I then tried to implement the socket using O_NONBLOCKING but that did not even let me connect. I have a feeling I am missing something very very simple here but it is not jumping out at me.
int nntpLogin(char *buffer, size_t bufsize, int sock)
{
char loginName[] = "AUTHINFO USER <username>\r\n";
char passwd[] = "AUTHINFO PASS <password>\r\n";
send(sock, loginName, sizeof(loginName), 0);
recv(sock, buffer, bufsize, 0);
printf("%s", buffer);
send(sock, passwd, sizeof(passwd), 0);
recv(sock, buffer, bufsize, 0);
printf("%s", buffer);
return 0;
}
The username and password have been removed. Does anyone know what might be going wrong here? It seems to be a blocking issue but I have no idea how to correct it.
Any help is appreciated.
.
- Follow-Ups:
- Re: NNTP client problem (BSD Sockets)
- From: David Schwartz
- Re: NNTP client problem (BSD Sockets)
- From: Barry Margolin
- Re: NNTP client problem (BSD Sockets)
- From: Logan Shaw
- Re: NNTP client problem (BSD Sockets)
- Prev by Date: Re: Thread in C
- Next by Date: Re: NNTP client problem (BSD Sockets)
- Previous by thread: Thread in C
- Next by thread: Re: NNTP client problem (BSD Sockets)
- Index(es):
Relevant Pages
|
|