Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
S

SquiZZlo

@SquiZZlo
About
Posts
2
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Sockets trouble in Visual Studio 2008
    S SquiZZlo

    Ok, I've found the answer to my problem on another forum:

      iLen = m\_strMessage.GetLength();
      CStringA ansiString(m\_strMessage);//one freaking conversion!
      iSent = m\_sConnectSocket.Send(ansiString, iLen); 
    

    Works prefectly! :-D

    C / C++ / MFC c++ visual-studio tutorial csharp help

  • Sockets trouble in Visual Studio 2008
    S SquiZZlo

    Hi. I'm stuck with the same problem. Whenever my program receives data from any tcp/ip server, it displays it correctly, but when it sends data back to the server, the latter receives only the first character. Turning off Unicode is not an option, becouse the tcp/ip communication is only a small part of the project, and this change generates lots of other errors. I'm also using the tutorial from David Chapman's "Teach yourself Visual C++ 6...", and Visual Studio 2k8, so my code is almost exactly the same as monu_biosman's. I'd like to ask Stuart, or anyone else for that matter, what exactly I need to change to make it work. I already made lots of tests, but none seem to work.

    //original code: (m_strMessage is a CString)
    iLen = m_strMessage.GetLength();
    iSent = m_sConnectSocket.Send(LPCTSTR(m_strMessage), iLen);

    //I've been changing the iLen, and it's not the problem. Then I've tried:
    iSent = m_sConnectSocket.Send("blablabla", 9);

    //and it works!!!. But then I've tried the seemingly same code:
    CString buffer = "blablabla";
    iSent = m_sConnectSocket.Send(buffer, 9);

    //and it also sends only one character (b to be exact). So the problem can propably be solved by adding //some type of conversion. So far i've tried this:
    char[1024] buffer;
    wsprintf(buffer,"%s",m_strMessage);
    iSent = m_sConnectSocket.Send(m_strMessage, 1024);
    //and.. it does not compile, C2664 error, "'wsprintfW' : cannot convert parameter 1 from 'char [1024]' to 'LPWSTR'"

    I'm running out of ideas, or maybe I'm a retard i don't know. Any help would be greatly appreciated. Thanks in advance. SquiZZlo

    C / C++ / MFC c++ visual-studio tutorial csharp help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups