Problem with CSocket and CArchive
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 3 of 3

Thread: Problem with CSocket and CArchive

  1. #1
    Join Date
    Feb 2004

    Problem with CSocket and CArchive

    I wantted to use CSocket to send and receive data with a HTTP sever. If I wrote it as:

    szOut = "GET http://...../ HTTP/1.0\n\n"
    m_pSocket->Send(szOut, szOut.GetLength());
    m_pSocket->Receive(szIn.GetBuffer(1024), 1024);

    It would be no problem and receive a "200 OK" status in szIn.

    But if I wrote it as:

    CSocketFile SocketFile(m_pSocket);
    CArchive arIn(&SocketFile, CArchive::load);
    CArchive arOut(&SocketFile, CArchive::store);
    arOut << szOut;
    arIn >> szIn;

    I would receive a "501 Not Implemented" errer status in szIn.

    Why this happened?


  2. #2
    Join Date
    May 2000
    KY, USA
    [Moved thread]
    Ciao, Andreas

    "Software is like sex, it's better when it's free." - Linus Torvalds

    Article(s): Allocators (STL) Function Objects (STL)

  3. #3
    Join Date
    Feb 2004
    Thank you, But I didn't use multithread. I write these codes in my main thread (the only thread in my application).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a survey!

HTML5 Development Center