not understand..
User 3650979
Posts
-
Send and Receive Problem -
Send and Receive Problemhi friend, After sending i want wait for acknowledgement(RecieveThread). Sendthread and recievethread individual Threads... Example: 1. 10 clients connected to my Communicator.... 2. I want to take associated client information(packets) from database i.e 10 or 100 packets i want sent proper client and wait for acknowledgment. After receiving acknowledgment i want sent another packet to corresponding client. 3. i want to all the clients like this... note : Socket Handler stored in Map; UINT RecieveThread(LPVOID pParam) { AfxSocketInit(); CSolusServerDlg *Dlg= (CSolusServerDlg*)pParam; bool bRun = true; SOCKET * pCurrentHandle; CSocket pSocket; char pBuf[4096]; CWinThread * pCurrentThread; pCurrentThread = AfxGetThread(); pCurrentHandle = &hClinetHandle; pSocket.Attach(hClinetHandle); for(int i=0;i<4096;i++) pBuf[i] = '\0'; int len; while(bRun) { if(pSocket.Receive(pBuf,4096)>0) { len = sizeof(pBuf); for( int i=0; i<len; i++ ) Dlg->ActionScanReceivedByte(pBuf[i]); } } CliThreadList.RemoveAt(CliThreadList.Find(pCurrentThread)); pSocket.ShutDown(2); pSocket.Close(); CliHandleList.RemoveAt(CliHandleList.Find(pCurrentHandle)); return 0; } UINT Sendthread(LPVOID pParam) { AfxSocketInit(); CSolusServerDlg *Dlg= (CSolusServerDlg*)pParam; bool bRun = true; SOCKET * pCurrentHandle; CSocket pSocket; char pBuf[4096]; CWinThread * pCurrentThread; pCurrentThread = AfxGetThread(); pCurrentHandle = &hClinetHandle; pSocket.Attach(hClinetHandle); vecUploadValues AcfManagementData; for(int i=0;i<4096;i++) pBuf[i] = '\0'; int len; FILE *fpUpload; char date [10]; char time [15]; SYSTEMTIME st; char* CStrTrim = new char[1024]; unsigned char *l_uca_Buffer; unsigned char l_uca_ActualData[1024]; unsigned char l_uca_Buffer1[2048]; unsigned char *cConverationBuffer; CString strTemp; char cstrTemp[512]; CDBFile objDB; CSocket *pSocketSent; while(bRun) { for(IteratorMap = mapControllerHandler.begin(); IteratorMap != mapControllerHandler.end() ;IteratorMap++) { char strControllerID[10]; char strControllerIID[10]; int ControllerId = (*IteratorMap).first; sprintf(strControllerID,"%06d ", ControllerId); memset(strControllerIID,0,sizeof(strControllerIID)); objDB.GetControllerID(strCo
-
Send and Receive Problemhi friends, i develop one protocol in MFC...i am using CSocket. main thread is Listen Thread..its ok fine.. in this thread all the client Handler stored in map..another two subthreads is Requestthread and Reponsethread.. Reponse thread sending Data to clients.. and Requestthread want recieve acknowledgement... i want send and recieve Continuesly existing clients.... i am facing problem childthreads...please any body...ugrent..
-
how i can use AsyncSelecthi friends, i wrote one protocal...facing problem...please help any bogy before Lisening i am dedicating socket p.AsyncSelect(FD_ACCEPT); i am Accepting All the Connections.... next i want to do Sent and recieve repately....but after Accepting Connections its not going sent.. i am using CAsyncSocket(OnAccept,OnSent,OnRecieve)...
-
System date and time c++hi i want system Date and time with Milli second.... iam using SYSTEMTIME st; GetSystemTime(&st); this one give wrong time...please any body
-
VC 2008 problemhi if i am running from exe its not working...
-
VC 2008 problemhi friends, i am using visual studio 2008... when i am using VS2008 Editor its working fine... when i am going run from Debug or release folder exe application is running...functionality is not working... please help any body....
-
how to trim Spaces from unsigned char*unsigned char pChar[100] = "i like vc++! "; printf("%s\n%s",pChar); it will compile and run..but it displaying 100 characters... 100 character means i like vc++ after null please help me any body
-
how to trim Spaces from unsigned char*hi friends, unsigned char Cstr[100] = "this is a program"; i want remove spaces from Cstr; please help any body
-
win32 debug to win32 release mode in vc6thank u friend.. but i am facing another problem... Release folder automatically create right.... after change release mode... i am trying to compile and run... C:\bujji\server\Release\Server.exe this file does not exist. do u want to build it? yes no i am clicking yes cannot Execute program
-
win32 debug to win32 release mode in vc6hi friends, 1.i created project in vc6. 2. project default setting is debug. 3. i am trying to change debug to release mode vc6 editor->project ->setting dialog i changed win32 debug to win32 release.. clicked ok... but i project setting is win32 debug only...i want to change win32 release... please help any body...
-
crasing in CAsyncSocket AcceptDebug asseration Failed... Program:c:\bujji\server\Debug\server.exe file : sockcoare.cpp line: 177 for more information on how your program can cause an asseration failure, see the vusial c++ Documentation on asserts. please help
-
crasing in CAsyncSocket Accepthi friends, class MyEchoSocket : public CAsyncSocket { public: virtual void OnAccept(int nErrorCode); virtual void OnClose(int nErrorCode); virtual void OnConnect(int nErrorCode); virtual void OnOutOfBandData(int nErrorCode); virtual void OnReceive(int nErrorCode); virtual void OnSend(int nErrorCode); }; class CServerDlg : : public CDialog { public: void OnReceive(); void OnClose(); void OnAccept(); void OnSent(); CSolusServerDlg(CWnd* pParent = NULL); // standard constructor }; void CServerDlg::OnAccept() { CString strIP; UINT port; if(m_sListener.Accept(m_sConnected)) { m_sConnected.GetPeerName(strIP,port); m_status = strIP ; UpdateData(FALSE); } else { AfxMessageBox("Cannot Accept Connection"); } } this above code is crasing 2nd client accepting or multiple client trying to connect please help me...
-
i want to know some functions in vb to vc++hi string Str; Asc(Mid(Str, i, 1)) in vb and i want in vc++ Chr$(Str(i)) in vb and i want in vc++ i donot vb...please help any one
-
convert CString to unsigned shorthi convertStringtoBSTR() this function is returning unsigned short only... i am giving correct input....but output is coming worning.... please help.... actual my problem is i have vb dll... Public Function f1(SendString As String) As String after loading vb dll t is the class pointer of vb dll... CString str = "000001"; unsigned short *stemp = _com_util::ConvertStringToBSTR(str); //stemp = 48 means 0 t->f1(&stemp) input / output unsigned short its showing...
-
convert CString to unsigned shorthi CString str = "000001"; unsigned short st =_com_util::ConvertStringToBSTR(str); st = 0x00000 is coming... please help any body..
-
how to pass Cstring to vb dll fuction in vc++hi friend, i have vb dll..in the vb dll one fuction f1; Public Function f1(SendString As String) As String - this function taking as argument and return string... how i will call in vc++; CoInitialize(NULL); hresult=CLSIDFromProgID(OLESTR("prjdll.clsdll"), &clsid); _clsdll *t; hresult=CoCreateInstance(clsid,NULL,CLSCTX_INPROC_SERVER,__uuidof(_clsdll),(LPVOID *) &t); CString str= "000001"; t->f1(str); // this is crasing.... please help any body.
-
CString to Unsigned short and unsigned short to CString in vc++hi friends please me any body......... how to convert CString Unsigned short and short to CString
-
howv to load vb activex dll in vc++hi thanks yar...i want some information... #import "test.dll" no_namespace named_guids // this is given compilation error please help me friend....
-
howv to load vb activex dll in vc++hi friends, please help me...