Hi...
I have created the UDP socket. I am broadcasting the message to 255.255.255.255 to know which are the machines using this application.
When I debug the program, the broadcasting is successful. But the message is not received....
Can anybody tell why this happened / What is the solution to this.....
Here is my code..........
I get the error .. "Failed to create the socket 10035, close & restart application"Code:oid CModifiedSocketDlg :: OnReceiveBroadcast() { TCHAR ReceivedBuf[ 70000 ]; CString SendersIP; TCHAR m_ScError[25]; UINT SendersPort = 8; int ChekReceived; UpdateData(TRUE); ChekReceived = UDPSockptr -> ReceiveFrom( ReceivedBuf, 69999, SendersIP, SendersPort ); if ( ChekReceived == SOCKET_ERROR ) { wsprintf( m_ScError, "Failed to create Socket %i Close And Restart application", GetLastError()); AfxMessageBox ( m_ScError ); } else { //TCHAR sazError[256]; //wsprintf(sazError, "OnReceive bytes: %d", ChekReceived); //AfxMessageBox (sazError); AfxMessageBox( "I come in OnReceive" ); CString Disp = ReceivedBuf; m_ReceivedData += Disp; UpdateData( FALSE ); } }
Then program crashes.




Reply With Quote