NNTP client problem (BSD Sockets)



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.

.



Relevant Pages

  • Re: NNTP client problem (BSD Sockets)
    ... I have sent the username after recieving the requires authentification ... command, but the program hangs on recv. ... int nntpLogin(char *buffer, size_t bufsize, int sock) ...
    (comp.unix.programmer)
  • Re: server scenario - variables in the right spot?
    ... If I'm correct in what I think you mean by 'data structures' then I also ... steps, the command has, and a way to mark which steps are done or not done, ... Assuming you are using the same receive callback for each BeginReceive, ... that processes the data for the first buffer. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: server scenario - variables in the right spot?
    ... ReceiveCallback calling beginReceive again: I do this but not exactly how ... Assuming you are using the same receive callback for each BeginReceive, then I don't see what the difference is. ... The posted receive won't be completed until after the command has been sent and replied to, of course, but there's no harm in being ready to receive beforehand. ... you would wind up running the code in the callback that actually processes the data for that buffer before the code in the same callback that processes the data for the first buffer. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: In vi/vim delete lines
    ... I frequently delete to a mark. ... | A buffer containing lines is put only once, ... | If the last command before a `.' ... The basic meta-characters for the replacement pattern are `&' and `~'; ...
    (comp.unix.shell)
  • Re: Spartados Help Needed
    ... All command line input, including all ... in the buffer during a key repeat. ... However, the XIO Atari ... your lomem will be at $17A2. ...
    (comp.sys.atari.8bit)