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

C / C++ / MFC

 
GeneralRe: dual interface Pin
George_George15-Sep-08 22:11
George_George15-Sep-08 22:11 
GeneralRe: dual interface Pin
George_George11-Sep-08 22:55
George_George11-Sep-08 22:55 
GeneralRe: dual interface Pin
led mike12-Sep-08 4:33
led mike12-Sep-08 4:33 
GeneralRe: dual interface Pin
led mike12-Sep-08 4:33
led mike12-Sep-08 4:33 
GeneralRe: dual interface Pin
George_George12-Sep-08 19:59
George_George12-Sep-08 19:59 
QuestionWinsock 10053 for my app but not for others/ [modified] Pin
LitteWindow11-Sep-08 15:21
LitteWindow11-Sep-08 15:21 
AnswerRe: Winsock 10053 for my app but not for others/ Pin
Mark Salsbery12-Sep-08 5:43
Mark Salsbery12-Sep-08 5:43 
GeneralRe: Winsock 10053 for my app but not for others/ Pin
LitteWindow12-Sep-08 9:52
LitteWindow12-Sep-08 9:52 
Here's me receive************************
void TWinsock::receiveDataFromServer(string& sDataBuffer )
{
int iResult = 0;
int bytesReceived = 0;
char buffer[ERRORBUFFERLEN];
char receiveBuffer[RECEIVEBUFFERLEN]; // Needed for the C to C++

// Clear out any junk out of the receive buffer .....
memset(receiveBuffer,NULL,RECEIVEBUFFERLEN);

// Make sure the data buffer is empty....
sDataBuffer = "";

// Receive data until the server closes the connection
do {

iResult = recv(ConnectSocket, receiveBuffer, RECEIVEBUFFERLEN, 0);

if( iResult > 0 ){
bytesReceived = iResult;
string temp(receiveBuffer);
sDataBuffer += temp;
#ifdef _DEBUG
// cout << "So far recv'd ....\r\n" << temp << endl;
#endif
}
else if ( iResult == 0 ){
// isConnected = false;
// throw EWinsockException (WSAGetLastError(), "Connection closed\n" );
}
else{
sprintf_s(buffer, "recv failed: %d\n", WSAGetLastError());
throw EWinsockException ( WSAGetLastError(), string(buffer) );
}
} while( iResult > 0 );

// Move it to the passed variable
sDataBuffer = receiveBuffer;
}
Here's the send***************************************************
void TWinsock::sendDataToServer(string sDataBuffer )
{
int iResult;
char buffer[ERRORBUFFERLEN];

if( isConnected )
{
// Send an initial buffer
iResult = send( ConnectSocket, sDataBuffer.c_str(), sDataBuffer.length(), 0 );

if (iResult == SOCKET_ERROR) {
sprintf_s(buffer, "send failed: %d\n", WSAGetLastError());
closesocket(ConnectSocket);
isConnected = false;
WSACleanup();
throw EWinsockException ( WSAGetLastError(), string(buffer) );
}
}
else{
throw EWinsockException ( string("Socket not connected.") );
}
}
GeneralRe: Winsock 10053 for my app but not for others/ Pin
Mark Salsbery12-Sep-08 10:25
Mark Salsbery12-Sep-08 10:25 
GeneralRe: Winsock 10053 for my app but not for others/ Pin
LitteWindow12-Sep-08 12:09
LitteWindow12-Sep-08 12:09 
GeneralRe: Winsock 10053 for my app but not for others/ Pin
Mark Salsbery12-Sep-08 12:24
Mark Salsbery12-Sep-08 12:24 
GeneralRe: Winsock 10053 for my app but not for others/ Pin
LitteWindow12-Sep-08 13:13
LitteWindow12-Sep-08 13:13 
GeneralRe: Winsock 10053 for my app but not for others/ Pin
Mark Salsbery12-Sep-08 13:29
Mark Salsbery12-Sep-08 13:29 
GeneralCommunication .....what I'm sending and receiving.... Pin
LitteWindow13-Sep-08 3:19
LitteWindow13-Sep-08 3:19 
GeneralRe: Communication .....what I'm sending and receiving.... Pin
Mark Salsbery13-Sep-08 8:34
Mark Salsbery13-Sep-08 8:34 
GeneralRe: Communication .....what I'm sending and receiving.... Pin
LitteWindow14-Sep-08 2:45
LitteWindow14-Sep-08 2:45 
GeneralRe: Communication .....what I'm sending and receiving.... Pin
Mark Salsbery14-Sep-08 9:39
Mark Salsbery14-Sep-08 9:39 
GeneralRe: Communication .....what I'm sending and receiving.... Pin
LitteWindow14-Sep-08 10:34
LitteWindow14-Sep-08 10:34 
GeneralRe: Communication .....what I'm sending and receiving.... Pin
Mark Salsbery14-Sep-08 13:21
Mark Salsbery14-Sep-08 13:21 
GeneralRe: Communication .....what I'm sending and receiving.... Pin
LitteWindow15-Sep-08 3:14
LitteWindow15-Sep-08 3:14 
GeneralRe: Communication .....what I'm sending and receiving.... Pin
Mark Salsbery15-Sep-08 5:29
Mark Salsbery15-Sep-08 5:29 
GeneralRe: Communication .....what I'm sending and receiving.... Pin
LitteWindow15-Sep-08 12:56
LitteWindow15-Sep-08 12:56 
QuestionRe: Winsock 10053 for my app but not for others/ Pin
Mark Salsbery12-Sep-08 12:25
Mark Salsbery12-Sep-08 12:25 
QuestionReturn true/false or TRUE/FALSE in COM? [modified] Pin
followait11-Sep-08 15:10
followait11-Sep-08 15:10 
AnswerRe: Return true/false or TRUE/FALSE in COM? Pin
David Crow11-Sep-08 17:11
David Crow11-Sep-08 17:11 

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.