Advertisement

vc++ winsock problem

Started by August 06, 2002 02:06 PM
2 comments, last by MattCarpenter 22 years, 6 months ago
I''ve been screwing around with visualc++''s winsock control in MFC, but I have a problem when I try to use the GetData function. WHat happens is when I do m_WinsockCOntrol.GetData(blablabla); the function automaticaly returns or something because nothing below that line of code runs! here is the code I am using: void Cdialg::OnDataArrivalWinsock1(long bytesTotal) { //----------------------------- //Client Sending Request Header //Retrieve it, then parse it. //----------------------------- COleVariant vdata,vdatatype,vdatalen; MessageBox("Trying to get data",NULL,MB_OK); m_Winsock.GetData(vdata,vdatatype,vdatalen); MessageBox("Got Data",NULL,MB_OK); } The messagebox that says its trying to get data fires just fine when I send data to winsock, but the messagebox that says ''got data'' doesn''t ever show up. What''s going on here?
//att
The socket control is blocking. If you send it some data it should continue execution. Search around for ''Winsock'' an ''blocking''.
Advertisement
Hm... All I can find on the internet is how to create a non blocking server with the winsock API. How would I do this with the winsock activeX control in MFC?
//att
I don''t thik it''s possible to set the socket to non-blocking with the control.

Really the control was only meant for VB. It has very basic functionality. Try switching to the CSocket or CAsyncSocket MFC classes instead of using the control. Those classes give you more control over the socket (no pun intended).

This topic is closed to new replies.

Advertisement