Click here to Skip to main content
15,887,083 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Sockets trouble in Visual Studio 2008 Pin
Stuart Dootson3-Jul-09 9:21
professionalStuart Dootson3-Jul-09 9:21 
GeneralRe: Sockets trouble in Visual Studio 2008 Pin
Manmohan293-Jul-09 9:39
Manmohan293-Jul-09 9:39 
GeneralRe: Sockets trouble in Visual Studio 2008 Pin
Stuart Dootson3-Jul-09 9:53
professionalStuart Dootson3-Jul-09 9:53 
GeneralRe: Sockets trouble in Visual Studio 2008 Pin
Manmohan293-Jul-09 10:21
Manmohan293-Jul-09 10:21 
GeneralRe: Sockets trouble in Visual Studio 2008 Pin
Stuart Dootson3-Jul-09 10:28
professionalStuart Dootson3-Jul-09 10:28 
GeneralRe: Sockets trouble in Visual Studio 2008 Pin
Stuart Dootson3-Jul-09 10:31
professionalStuart Dootson3-Jul-09 10:31 
GeneralRe: Sockets trouble in Visual Studio 2008 Pin
Manmohan293-Jul-09 10:48
Manmohan293-Jul-09 10:48 
GeneralRe: Sockets trouble in Visual Studio 2008 Pin
SquiZZlo31-Aug-09 14:48
SquiZZlo31-Aug-09 14:48 
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
AnswerRe: Sockets trouble in Visual Studio 2008 Pin
SquiZZlo1-Sep-09 5:11
SquiZZlo1-Sep-09 5:11 
QuestionMake print dialog for CHtmlView modal? Pin
Keith Worden3-Jul-09 4:58
Keith Worden3-Jul-09 4:58 
Questionhow to show a .ico file at the window title bar Pin
Rajib Podder3-Jul-09 4:35
Rajib Podder3-Jul-09 4:35 
AnswerRe: how to show a .ico file at the window title bar Pin
Roger Stoltz3-Jul-09 5:02
Roger Stoltz3-Jul-09 5:02 
GeneralRe: how to show a .ico file at the window title bar Pin
Rajib Podder5-Jul-09 17:00
Rajib Podder5-Jul-09 17:00 
GeneralRe: how to show a .ico file at the window title bar Pin
Roger Stoltz5-Jul-09 20:10
Roger Stoltz5-Jul-09 20:10 
GeneralRe: how to show a .ico file at the window title bar Pin
Rajib Podder5-Jul-09 20:15
Rajib Podder5-Jul-09 20:15 
Questioncalling OnDraw() Pin
susanne13-Jul-09 4:09
susanne13-Jul-09 4:09 
AnswerRe: calling OnDraw() Pin
Stuart Dootson3-Jul-09 5:34
professionalStuart Dootson3-Jul-09 5:34 
GeneralRe: calling OnDraw() Pin
susanne14-Jul-09 7:05
susanne14-Jul-09 7:05 
GeneralRe: calling OnDraw() Pin
Stuart Dootson4-Jul-09 7:33
professionalStuart Dootson4-Jul-09 7:33 
Questionwhat is the entry id for junk mail Pin
santhosh-padamatinti3-Jul-09 3:54
santhosh-padamatinti3-Jul-09 3:54 
Questionxmlhttp improper response Pin
Ash_VCPP3-Jul-09 2:28
Ash_VCPP3-Jul-09 2:28 
AnswerRe: xmlhttp improper response Pin
Stuart Dootson3-Jul-09 3:34
professionalStuart Dootson3-Jul-09 3:34 
Questionthreads and their time slots. [modified] Pin
Souldrift2-Jul-09 23:45
Souldrift2-Jul-09 23:45 
AnswerRe: threads and their time slots. Pin
Stuart Dootson3-Jul-09 0:31
professionalStuart Dootson3-Jul-09 0:31 
GeneralRe: threads and their time slots. [modified] Pin
Souldrift3-Jul-09 1:17
Souldrift3-Jul-09 1:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.