Re: NNTP client problem (BSD Sockets)



On 2008-03-17 05:53:20 +0000, David Schwartz <davids@xxxxxxxxxxxxx> said:

On Mar 16, 11:09 am, Niz <n...@xxxxxxxxxxx> wrote:

I know you may be thinking that you'll just do things the quick way
first and clean it up later, but it will save you a lot of trouble to
do it right from the beginning.

You throw away the return value. What if you only received one byte
and didn't get the whole message?

That is just for ease of reading on the newsgroup. The return value is checked in my actual code.


printf("%s", buffer);

The '%s' specifier is for C-style strings. You don't have a C-style
string, you just have an arbitrary collection of characters. So why
are you treating it as a string?

I was under the impression that a string was an arbitary collection of characters. Anyway it is irrelavant at the moment due to the fact that it never reaches this point anyway :).

The %s printf statement works fine for a malloced array of char, what is the best option to use?

If you 'telnet' to the NNTP server and send these two strings, do you
normally get a reply after the 'AUTHINFO PASS' line?

DS

Ah, doh never thought to use Telnet to check this.


.



Relevant Pages

  • Re: NNTP client problem (BSD Sockets)
    ... string, you just have an arbitrary collection of characters. ... An arbitrary collection of characters is *NOT* a C- ... NNTP is a text-based protocol, there should never be any embedded nulls. ...
    (comp.unix.programmer)
  • Re: NNTP client problem (BSD Sockets)
    ... string, you just have an arbitrary collection of characters. ... An arbitrary collection of characters is *NOT* a C- ... style string and can be disastrous to pass it to functions that take C- ...
    (comp.unix.programmer)
  • Re: Clean string
    ... What would you suggest is the smoothest way of cleaning up a $string, ... This is to clean various strings from special characters, ...
    (comp.lang.perl.misc)
  • Clean string
    ... What would you suggest is the smoothest way of cleaning up a $string, ... This is to clean various strings from special characters, ...
    (comp.lang.perl.misc)
  • regexp hangs script
    ... I'm trying to clean off a few characters from the beginning of a string. ... The prepended flags match the values in my @form_flags array. ...
    (comp.lang.perl.misc)