Click here to Skip to main content
15,898,222 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionwaveOutOpen returning no message?? Pin
AmbiguousName8-Aug-10 2:45
AmbiguousName8-Aug-10 2:45 
AnswerRe: waveOutOpen returning no message?? Pin
Richard MacCutchan8-Aug-10 2:54
mveRichard MacCutchan8-Aug-10 2:54 
GeneralRe: waveOutOpen returning no message?? Pin
AmbiguousName8-Aug-10 4:30
AmbiguousName8-Aug-10 4:30 
GeneralRe: waveOutOpen returning no message?? Pin
Luc Pattyn8-Aug-10 4:58
sitebuilderLuc Pattyn8-Aug-10 4:58 
GeneralRe: waveOutOpen returning no message?? Pin
Richard MacCutchan8-Aug-10 5:31
mveRichard MacCutchan8-Aug-10 5:31 
QuestionAvoiding Resource Conflicts in MFC Extension DLLs Pin
softwaremonkey7-Aug-10 21:07
softwaremonkey7-Aug-10 21:07 
AnswerRe: Avoiding Resource Conflicts in MFC Extension DLLs Pin
Niklas L7-Aug-10 22:27
Niklas L7-Aug-10 22:27 
GeneralRe: Avoiding Resource Conflicts in MFC Extension DLLs Pin
softwaremonkey8-Aug-10 4:21
softwaremonkey8-Aug-10 4:21 
QuestionError :: C1061 compiler limit : blocks nested too deeply Pin
Le@rner6-Aug-10 22:31
Le@rner6-Aug-10 22:31 
AnswerRe: Error :: C1061 compiler limit : blocks nested too deeply Pin
Code-o-mat6-Aug-10 22:52
Code-o-mat6-Aug-10 22:52 
GeneralRe: Error :: C1061 compiler limit : blocks nested too deeply Pin
Le@rner6-Aug-10 23:23
Le@rner6-Aug-10 23:23 
GeneralRe: Error :: C1061 compiler limit : blocks nested too deeply [modified] Pin
Richard MacCutchan7-Aug-10 2:39
mveRichard MacCutchan7-Aug-10 2:39 
GeneralRe: Error :: C1061 compiler limit : blocks nested too deeply Pin
MuraliKrishnaP7-Aug-10 3:07
MuraliKrishnaP7-Aug-10 3:07 
AnswerRe: Error :: C1061 compiler limit : blocks nested too deeply Pin
Luc Pattyn7-Aug-10 11:02
sitebuilderLuc Pattyn7-Aug-10 11:02 
GeneralRe: Error :: C1061 compiler limit : blocks nested too deeply Pin
David Crow7-Aug-10 15:58
David Crow7-Aug-10 15:58 
AnswerRe: Error :: C1061 compiler limit : blocks nested too deeply Pin
Moak6-Aug-10 23:14
Moak6-Aug-10 23:14 
QuestionConnectEx fails Pin
followait6-Aug-10 14:25
followait6-Aug-10 14:25 
AnswerRe: ConnectEx fails Pin
Richard Andrew x646-Aug-10 15:06
professionalRichard Andrew x646-Aug-10 15:06 
GeneralRe: ConnectEx fails Pin
followait6-Aug-10 16:09
followait6-Aug-10 16:09 
tried, still not work

int main()
{
	WSADATA wsa;
	int res = WSAStartup(MAKEWORD(2,2), &wsa);
	assert(res==0);

	SOCKADDR_IN addr_in;
	addr_in.sin_family = AF_INET;
	addr_in.sin_addr.s_addr = inet_addr("127.0.0.1");
	addr_in.sin_port = htons(5150);
	ZeroMemory(&addr_in.sin_zero, sizeof(addr_in.sin_zero));

	SOCKET s = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, 0);
	assert(s!=INVALID_SOCKET);
	SOCKADDR_IN addr_in_local;
	addr_in_local.sin_family = AF_INET;
	addr_in_local.sin_addr.s_addr = INADDR_ANY;
	addr_in_local.sin_port = 0;
	ZeroMemory(&addr_in_local.sin_zero, sizeof(addr_in_local.sin_zero));
	res = bind(s, (sockaddr*)&addr_in_local, sizeof(addr_in_local));
	assert(res==0);

	//prepare function
	{
		DWORD dwBytes;
		int res = WSAIoctl(s,
			SIO_GET_EXTENSION_FUNCTION_POINTER,
			&GuidConnectEx,
			sizeof(GuidConnectEx),
			&g_lpfnConnectEx,
			sizeof(g_lpfnConnectEx),
			&dwBytes,
			NULL,
			NULL);

		int err = WSAGetLastError();

		assert(res==0);
	}	

	DWORD bytes_sent;
	BOOL ok = (*g_lpfnConnectEx)(s, (sockaddr*)&addr_in, sizeof(addr_in), NULL, 0, &bytes_sent, NULL);
	int err = WSAGetLastError();
	assert(ok);
	//int ok = connect(s, (sockaddr*)&addr_in, sizeof(addr_in));
	//assert(ok==0);

	for (int i=0; i<10; ++i)
	{
		char buf[256];
		sprintf_s(buf, sizeof(buf), "message %d", i);
		WSABUF wsa_buf;
		wsa_buf.buf = buf;
		wsa_buf.len = strlen(buf);
		DWORD bytes_sent;
		int res = WSASend(s, &wsa_buf, 1, &bytes_sent, 0, NULL, NULL);
		assert(res==0 && bytes_sent==wsa_buf.len);
		printf_s("sent: %s\n", buf);
		Sleep(1000);
	}

	WSACleanup();

	return 0;
}

GeneralRe: ConnectEx fails Pin
Richard MacCutchan6-Aug-10 21:49
mveRichard MacCutchan6-Aug-10 21:49 
GeneralRe: ConnectEx fails Pin
followait7-Aug-10 2:16
followait7-Aug-10 2:16 
GeneralRe: ConnectEx fails Pin
Richard MacCutchan7-Aug-10 2:24
mveRichard MacCutchan7-Aug-10 2:24 
GeneralRe: ConnectEx fails Pin
followait7-Aug-10 4:28
followait7-Aug-10 4:28 
GeneralRe: ConnectEx fails Pin
Richard MacCutchan7-Aug-10 5:35
mveRichard MacCutchan7-Aug-10 5:35 
GeneralRe: ConnectEx fails [modified] Pin
Richard MacCutchan7-Aug-10 5:56
mveRichard MacCutchan7-Aug-10 5:56 

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.