Click here to Skip to main content
15,881,882 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Application Error Pin
Hans Dietrich24-Jan-11 0:48
mentorHans Dietrich24-Jan-11 0:48 
GeneralRe: Application Error Pin
shiv@nand24-Jan-11 1:01
shiv@nand24-Jan-11 1:01 
GeneralRe: Application Error Pin
Andrew Brock24-Jan-11 1:07
Andrew Brock24-Jan-11 1:07 
GeneralRe: Application Error Pin
shiv@nand24-Jan-11 1:19
shiv@nand24-Jan-11 1:19 
GeneralRe: Application Error Pin
Hans Dietrich24-Jan-11 1:25
mentorHans Dietrich24-Jan-11 1:25 
AnswerRe: Application Error Pin
Stephen Hewitt24-Jan-11 1:45
Stephen Hewitt24-Jan-11 1:45 
AnswerRe: Application Error Pin
Malli_S24-Jan-11 2:11
Malli_S24-Jan-11 2:11 
GeneralRe: Application Error Pin
shiv@nand24-Jan-11 4:26
shiv@nand24-Jan-11 4:26 
this error because i am creating multiple thread using AfxBeginThread() see below
my code :

WSADATA wsaData;
WSAStartup(0x0101, &wsaData );

struct sockaddr_in stSockaddr_in;
struct sockaddr stSockaddr;

SOCKET sock;
fd_set readfds1;
FD_ZERO( &readfds1);

//create listening socket
sock = socket(AF_INET,SOCK_STREAM,0);//create socket

//sets the family,port and the addrees
stSockaddr_in.sin_family = AF_INET;
stSockaddr_in.sin_addr.s_addr = INADDR_ANY;
stSockaddr_in.sin_port = htons(9000)

//Use bind to establish the local association of the socket by assigning a local name to an unnamed socket
int nRet = bind(sock, (LPSOCKADDR)&stSockaddr_in, sizeof(struct sockaddr));//bind

//listen function places a socket a state where it is listening for an incoming connection
if(listen( sock, MAX_CONNECTS ) < 0)//listen
{
//listen error
return 0;
}


SOCKET ret_sock;

//accept the connection
ret_sock = accept(sock,&stSockaddr,NULL);

if(INVALID_SOCKET != ret_sock)
{

char szBuffer[MAX_BUF_LEN];
//to receive the configuration data
int iLength = recv( ret_sock,(char*) szBuffer, MAX_BUF_LEN, 0 );
szBuffer[iLength] = 0;

CString csBuffer;
int iLen = strlen(szBuffer);

WCHAR wcStr[MAX_DATA_SIZE];

memset(wcStr,'\0',sizeof(WCHAR)*MAX_DATA_SIZE);

mbstowcs( wcStr,szBuffer,iLen);

csBuffer.Format(L"%s",wcStr);



////////////////////////////////////////////////////////////////////////
if(!csBuffer.IsEmpty())//data is not empty
{
CWinThread *Thread = NULL;
Thread = AfxBeginThread(func,(LPVOID)&someValue,THREAD_PRIORITY_NORMAL,0,0,NULL); //Here only i am getting the apllication error (Not Creating Multiple thead)
}
}

How to resolve this problem ?
GeneralRe: Application Error Pin
Hans Dietrich24-Jan-11 4:35
mentorHans Dietrich24-Jan-11 4:35 
GeneralRe: Application Error Pin
shiv@nand24-Jan-11 4:38
shiv@nand24-Jan-11 4:38 
GeneralRe: Application Error Pin
Hans Dietrich24-Jan-11 4:48
mentorHans Dietrich24-Jan-11 4:48 
GeneralRe: Application Error [modified] Pin
shiv@nand24-Jan-11 5:01
shiv@nand24-Jan-11 5:01 
QuestionRe: Application Error Pin
David Crow24-Jan-11 5:29
David Crow24-Jan-11 5:29 
QuestionDiffrent language string data problem? Pin
Le@rner23-Jan-11 23:35
Le@rner23-Jan-11 23:35 
AnswerRe: Diffrent language string data problem? Pin
Andrew Brock23-Jan-11 23:41
Andrew Brock23-Jan-11 23:41 
GeneralRe: Diffrent language string data problem? Pin
Le@rner23-Jan-11 23:43
Le@rner23-Jan-11 23:43 
GeneralRe: Diffrent language string data problem? Pin
Andrew Brock23-Jan-11 23:51
Andrew Brock23-Jan-11 23:51 
GeneralRe: Diffrent language string data problem? Pin
Le@rner23-Jan-11 23:53
Le@rner23-Jan-11 23:53 
AnswerRe: Diffrent language string data problem? Pin
ShilpiP24-Jan-11 0:39
ShilpiP24-Jan-11 0:39 
QuestionMulti Threaded program With allegro. Pin
Thilina.madush23-Jan-11 23:16
Thilina.madush23-Jan-11 23:16 
AnswerRe: Multi Threaded program With allegro. Pin
Andrew Brock23-Jan-11 23:54
Andrew Brock23-Jan-11 23:54 
GeneralRe: Multi Threaded program With allegro. Pin
Thilina.madush24-Jan-11 0:02
Thilina.madush24-Jan-11 0:02 
GeneralRe: Multi Threaded program With allegro. Pin
Andrew Brock24-Jan-11 0:07
Andrew Brock24-Jan-11 0:07 
QuestionHow to set a icon to the column of the CListCtrl Pin
yu-jian23-Jan-11 21:06
yu-jian23-Jan-11 21:06 
AnswerRe: How to set a icon to the column of the CListCtrl Pin
ShilpiP23-Jan-11 22:45
ShilpiP23-Jan-11 22:45 

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.