Click here to Skip to main content
16,016,744 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: PutFile(…) works - GetFile(…) doesn't… ? Pin
David Crow3-Sep-04 2:30
David Crow3-Sep-04 2:30 
GeneralRe: PutFile(…) works - GetFile(…) doesn't… ? Pin
anderslundsgard3-Sep-04 2:35
anderslundsgard3-Sep-04 2:35 
GeneralRe: PutFile(…) works - GetFile(…) doesn't… ? Pin
David Crow3-Sep-04 2:41
David Crow3-Sep-04 2:41 
GeneralRe: PutFile(…) works - GetFile(…) doesn't… ? Pin
anderslundsgard5-Sep-04 20:01
anderslundsgard5-Sep-04 20:01 
Generalhelp : h.263 concern Pin
adoration3-Sep-04 1:28
adoration3-Sep-04 1:28 
GeneralCSockets in multiple threads Pin
snodgrass3-Sep-04 1:18
snodgrass3-Sep-04 1:18 
GeneralRe: CSockets in multiple threads Pin
jan larsen3-Sep-04 1:34
jan larsen3-Sep-04 1:34 
GeneralRe: CSockets in multiple threads Pin
BlackDice3-Sep-04 7:16
BlackDice3-Sep-04 7:16 
I don't know if this is your problem, but I was having a problem yesterday with using a thread and CSocket. Microsoft has a confirmed bug in which certain members of CAsyncSocket don't get initialized correctly in a second thread (or something like that). The resolution was to put a call to the function I'm going to include below. This function can be a member of your class as long as you also make this static. Also this must be called before EVERY creation of a CSocket object in the second thread if you're doing it like I was in a loop.

void [YourClassName]::SocketThreadInit(void)
{
	//this function sets up the socket class's member variables correctly if using in a separate thread
	//this needs to be done and is a confirmed bug by Microsoft
#ifndef _AFXDLL
#define _AFX_SOCK_THREAD_STATE AFX_MODULE_THREAD_STATE
#define _afxSockThreadState AfxGetModuleThreadState()
	_AFX_SOCK_THREAD_STATE* pState = _afxSockThreadState;
	if (pState->m_pmapSocketHandle == NULL)
		pState->m_pmapSocketHandle = new CMapPtrToPtr;
	if (pState->m_pmapDeadSockets == NULL)
		pState->m_pmapDeadSockets = new CMapPtrToPtr;
	if (pState->m_plistSocketNotifications == NULL)
		pState->m_plistSocketNotifications = new CPtrList;
#endif

}


[insert witty comment here]

bdiamond Sleepy | :zzz:
GeneralRe: CSockets in multiple threads Pin
snodgrass3-Sep-04 13:10
snodgrass3-Sep-04 13:10 
GeneralRe: CSockets in multiple threads Pin
BlackDice6-Sep-04 3:02
BlackDice6-Sep-04 3:02 
GeneralRe: CSockets in multiple threads Pin
snodgrass6-Sep-04 5:25
snodgrass6-Sep-04 5:25 
GeneralWritting data to CD Pin
verma-rahul3-Sep-04 1:17
verma-rahul3-Sep-04 1:17 
GeneralRe: Writting data to CD Pin
Member 3076123-Sep-04 2:07
Member 3076123-Sep-04 2:07 
GeneralRe: Writting data to CD Pin
verma-rahul3-Sep-04 2:15
verma-rahul3-Sep-04 2:15 
GeneralRe: Writting data to CD Pin
Member 3076123-Sep-04 2:55
Member 3076123-Sep-04 2:55 
GeneralRe: Writting data to CD Pin
Henry miller3-Sep-04 2:57
Henry miller3-Sep-04 2:57 
GeneralConverting 32 bit bitmap image to 24 bit bitmap image Pin
hasansheik3-Sep-04 0:34
hasansheik3-Sep-04 0:34 
GeneralRe: Converting 32 bit bitmap image to 24 bit bitmap image Pin
Bob Stanneveld3-Sep-04 12:15
Bob Stanneveld3-Sep-04 12:15 
GeneralRe: Converting 32 bit bitmap image to 24 bit bitmap image Pin
Ayman Kouzayha30-Jun-10 14:27
Ayman Kouzayha30-Jun-10 14:27 
GeneralRe: Converting 32 bit bitmap image to 24 bit bitmap image Pin
Bob Stanneveld30-Jun-10 20:16
Bob Stanneveld30-Jun-10 20:16 
GeneralInterprocess communication question... Pin
karam_chand3-Sep-04 0:16
karam_chand3-Sep-04 0:16 
GeneralCSockets Windows 2003 Pin
shiraztk2-Sep-04 23:40
shiraztk2-Sep-04 23:40 
GeneralRe: CSockets Windows 2003 Pin
jan larsen3-Sep-04 1:46
jan larsen3-Sep-04 1:46 
GeneralRe: CSockets Windows 2003 Pin
shiraztk3-Sep-04 2:11
shiraztk3-Sep-04 2:11 
GeneralRe: CSockets Windows 2003 Pin
shiraztk3-Sep-04 20:06
shiraztk3-Sep-04 20:06 

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.