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

C / C++ / MFC

 
GeneralRe: OnSize() problem in Maximize Pin
Anu_Bala18-Mar-10 1:36
Anu_Bala18-Mar-10 1:36 
Questionbutton in one subitem for CListCtrl? Pin
sairamdp18-Mar-10 0:01
sairamdp18-Mar-10 0:01 
AnswerRe: button in one subitem for CListCtrl? Pin
Eugen Podsypalnikov18-Mar-10 0:12
Eugen Podsypalnikov18-Mar-10 0:12 
GeneralRe: button in one subitem for CListCtrl? [modified] Pin
mesajflaviu18-Mar-10 19:53
mesajflaviu18-Mar-10 19:53 
QuestionMaking a CWnd transparent Pin
Member 471222117-Mar-10 23:52
Member 471222117-Mar-10 23:52 
AnswerRe: Making a CWnd transparent Pin
Eugen Podsypalnikov18-Mar-10 0:01
Eugen Podsypalnikov18-Mar-10 0:01 
GeneralRe: Making a CWnd transparent Pin
Member 471222118-Mar-10 0:58
Member 471222118-Mar-10 0:58 
Questionclient - Server Connection problem Pin
Game-point17-Mar-10 23:40
Game-point17-Mar-10 23:40 
Hello Sir

Currently i am doing one client - server program,

when i connect client - server its shows error code 10049

server code :

WSADATA wsadata;

	DWORD version = MAKEWORD (2,2);

	int Result , Error_Code;

	CString Error_Result;

	Result = WSAStartup( version,&wsadata);

	if ( Result != 0 )
	{
		Error_Code = WSAGetLastError();

		Error_Result.Format ("%d",Error_Code) ;

		MessageBox ( " Socket Opration Failed :"+Error_Result )	;
	}
	else
	{
		// Socket Creation

		SOCKET server_Socket;

		if ( (server_Socket = socket ( AF_INET,SOCK_STREAM,IPPROTO_TCP) )== SOCKET_ERROR )
		{

			Error_Code = WSAGetLastError();

			Error_Result.Format ("%d",Error_Code );

			MessageBox ("Server Socket Creation is Failed : "+Error_Result);
		}

		else
		{
			
			// Initialize Server Socket Structure

			SOCKADDR_IN serverStructure;

			int Port = 808;

			serverStructure.sin_family = AF_INET;

			serverStructure.sin_port = htonl (Port);
			
			serverStructure.sin_addr.S_un.S_addr = htonl(ADDR_ANY) ;

			// Bind the Server Socket

			Result = bind ( server_Socket,(SOCKADDR*)&serverStructure,sizeof(serverStructure));

			if ( Result==0 )
			{
			
				Result = listen(server_Socket,5);

				if (Result!=0)
				{
				
					Error_Result.Format ("%d",WSAGetLastError());

					MessageBox("Socket listen is Failed :"+Error_Result);
				}
				else
				{
					// Create New Socket

					SOCKET ClientSocket;

					if ( (ClientSocket = accept (server_Socket,NULL,NULL) ) ==INVALID_SOCKET )
					{
						Error_Result.Format ("%d",WSAGetLastError());

						MessageBox ("Socket Accept is Failed :"+Error_Result);
					}



client code:

	WSADATA wsadata;

	int Result_Client;

	CString strClient_Result;

	DWORD version = MAKEWORD (2,2);

	Result_Client = WSAStartup( version,&wsadata);

	if (Result_Client==0 )
	{
	
		// Create Client Socket
		
		SOCKET ClientSocket;

		if ( (ClientSocket = socket (AF_INET,SOCK_STREAM,IPPROTO_TCP)) != INVALID_SOCKET)
		{
		
			// Initialize Client Socket structure

			int Port = 808;

			SOCKADDR_IN ClientSocketStructure;

			ClientSocketStructure.sin_family = AF_INET;

			ClientSocketStructure.sin_port = htonl(Port);

			ClientSocketStructure.sin_addr.S_un.S_addr =inet_addr("192.168.1.21") ;

			Result_Client = <code>connect(ClientSocket,(SOCKADDR*)&ClientSocketStructure,sizeof(ClientSocketStructure));
</code>
			if ( Result_Client == 0)
			{
			
				char* SendMessage_Server = "Test";

				send(ClientSocket,SendMessage_Server,sizeof (SendMessage_Server),NULL);

				closesocket(ClientSocket);

				WSACleanup();

			}
			else
			{
				strClient_Result.Format ("%d",WSAGetLastError());
				MessageBox ("Client: Sever Socket Connection is failed "+strClient_Result)	; // Showing Error
			}
Unsure | :~ Failure is Success If we learn from it!!Unsure | :~


AnswerRe: client - Server Connection problem Pin
Moak18-Mar-10 1:07
Moak18-Mar-10 1:07 
Questionlocalization problem Pin
Member 59031017-Mar-10 23:10
Member 59031017-Mar-10 23:10 
AnswerRe: localization problem Pin
Eugen Podsypalnikov17-Mar-10 23:27
Eugen Podsypalnikov17-Mar-10 23:27 
GeneralRe: localization problem Pin
Member 59031017-Mar-10 23:31
Member 59031017-Mar-10 23:31 
AnswerRe: localization problem Pin
Avi Berger17-Mar-10 23:34
Avi Berger17-Mar-10 23:34 
AnswerRe: localization problem Pin
Abhi Lahare18-Mar-10 4:52
Abhi Lahare18-Mar-10 4:52 
QuestionBlobk Key Pin
john563217-Mar-10 22:54
john563217-Mar-10 22:54 
AnswerRe: Blobk Key Pin
CPallini17-Mar-10 22:58
mveCPallini17-Mar-10 22:58 
GeneralRe: Blobk Key Pin
john563217-Mar-10 23:05
john563217-Mar-10 23:05 
GeneralRe: Blobk Key Pin
CPallini17-Mar-10 23:08
mveCPallini17-Mar-10 23:08 
AnswerRe: Blobk Key Pin
Adam Roderick J17-Mar-10 23:27
Adam Roderick J17-Mar-10 23:27 
QuestionHow do I get the notification when the user modifies the DNS server address? Pin
EverettJF17-Mar-10 20:11
EverettJF17-Mar-10 20:11 
Questionhow to draw a sector of a circle? Pin
tho_mee17-Mar-10 13:55
tho_mee17-Mar-10 13:55 
AnswerRe: how to draw a sector of a circle? Pin
Avi Berger17-Mar-10 15:23
Avi Berger17-Mar-10 15:23 
AnswerRe: how to draw a sector of a circle? Pin
Adam Roderick J17-Mar-10 18:25
Adam Roderick J17-Mar-10 18:25 
AnswerRe: how to draw a sector of a circle? Pin
Eugen Podsypalnikov17-Mar-10 21:14
Eugen Podsypalnikov17-Mar-10 21:14 
GeneralRe: how to draw a sector of a circle? Pin
tho_mee27-Mar-10 6:12
tho_mee27-Mar-10 6:12 

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.