Click here to Skip to main content
15,921,156 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: std::vector - issues Pin
toxcct8-Dec-05 4:53
toxcct8-Dec-05 4:53 
GeneralRe: std::vector - issues Pin
ddmcr8-Dec-05 5:01
ddmcr8-Dec-05 5:01 
GeneralRe: std::vector - issues Pin
toxcct8-Dec-05 5:06
toxcct8-Dec-05 5:06 
QuestionFile locking problems?? Pin
chilituna8-Dec-05 3:05
chilituna8-Dec-05 3:05 
AnswerRe: File locking problems?? Pin
David Crow8-Dec-05 3:20
David Crow8-Dec-05 3:20 
QuestionAdd Picturebox into the Form Pin
JanakKoshia8-Dec-05 2:51
JanakKoshia8-Dec-05 2:51 
AnswerRe: Add Picturebox into the Form Pin
BlackDice8-Dec-05 6:09
BlackDice8-Dec-05 6:09 
QuestionNetworking Pin
Girish6018-Dec-05 1:41
Girish6018-Dec-05 1:41 
Dear friends,

we develop one module. server is broadcasting. client receive this broadcast. Bind() happen properly. socket create properly. It return value properly. At the time of receiving data, client create some problem. problem means entire application hangs. we use while loop. Result shows,
Brodcast done properly. Bind() happen proerly. then what is the reason that entire application hang properly at the time of receiving data.

Result also shows UDP port is proper. TCP/IP port is also proper. UDP port number is 3000. TCP/IP port is 1024.

Everything is properly , then also application hang.

sample code of that function

BOOL CEliteUtilities::ReceiveBroadcastUDP(CString *TargetIP,int *m_port)
{
SOCKADDR_IN addr_Srv, addr_Cli;

char szMessage[256];
int listenport;
int clilen;
int val = 1;
CString csTemp;

AfxSocketInit(NULL);
listenport =3000;

if (listenport < 1)
{
AfxMessageBox("Please enter a valid UDP listen port");
}

//-- Open a UDP socket
if ((sock_Receive = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
{
AfxMessageBox("Unable to create socket");
return FALSE;
}

//-- Fill in structure fields for binding to local host

//memset((char *) &addr_Srv, 0, sizeof(addr_Srv));


addr_Srv.sin_family = AF_INET;
addr_Srv.sin_addr.s_addr = htonl(INADDR_ANY);
addr_Srv.sin_port = htons(listenport);

int retval=bind(sock_Receive,(SOCKADDR* )&addr_Srv, sizeof(addr_Srv));

if(retval==0)
{
AfxMessageBox("Successfully done");
}
else
{
AfxMessageBox("Failed");
}
memset((char *)&addr_Cli, 0, sizeof(addr_Cli));

clilen = sizeof(addr_Cli);


/*while(1)
{
if(recvfrom(sock_Receive,szMessage,256,0,(sockaddr *)&addr_Cli,&clilen)==SOCKET_ERROR)
{
AfxMessageBox("Error in Receive From");
return false;
}
else
{
char test[5];
itoa(*m_port,test,10);
if(strcmp(szMessage,test)==0)
{
//AfxMessageBox("port detected");
break;
}
}
}*/
closesocket(sock_Receive);
return TRUE;
}

our application hang when debugger comes in while loop.

please give reply of my problem.

Regards
kedar
QuestionHow to get the real parent of a service process Pin
Vaskoder8-Dec-05 0:23
Vaskoder8-Dec-05 0:23 
AnswerRe: How to get the real parent of a service process Pin
Blake Miller8-Dec-05 10:12
Blake Miller8-Dec-05 10:12 
QuestionDisplay views on different screens dimension problem Pin
mikobi8-Dec-05 0:19
mikobi8-Dec-05 0:19 
AnswerRe: Display views on different screens dimension problem Pin
khan++8-Dec-05 0:38
khan++8-Dec-05 0:38 
GeneralRe: Display views on different screens dimension problem Pin
mikobi8-Dec-05 1:00
mikobi8-Dec-05 1:00 
GeneralRe: Display views on different screens dimension problem Pin
Cedric Moonen8-Dec-05 1:24
Cedric Moonen8-Dec-05 1:24 
GeneralRe: Display views on different screens dimension problem Pin
khan++8-Dec-05 1:32
khan++8-Dec-05 1:32 
GeneralRe: Display views on different screens dimension problem Pin
mikobi8-Dec-05 2:06
mikobi8-Dec-05 2:06 
GeneralRe: Display views on different screens dimension problem Pin
khan++8-Dec-05 2:19
khan++8-Dec-05 2:19 
GeneralRe: Display views on different screens dimension problem Pin
mikobi8-Dec-05 2:43
mikobi8-Dec-05 2:43 
GeneralRe: Display views on different screens dimension problem Pin
khan++8-Dec-05 2:57
khan++8-Dec-05 2:57 
QuestionListCtrl containing tree control Pin
doubts.vc8-Dec-05 0:06
doubts.vc8-Dec-05 0:06 
QuestionMSCS Cluster Question Pin
Sandeep Shetty7-Dec-05 23:36
Sandeep Shetty7-Dec-05 23:36 
QuestionHow to display a set of BYTE on the screen? Pin
Ming Luo7-Dec-05 23:01
Ming Luo7-Dec-05 23:01 
AnswerRe: How to display a set of BYTE on the screen? Pin
Cedric Moonen7-Dec-05 23:13
Cedric Moonen7-Dec-05 23:13 
GeneralRe: How to display a set of BYTE on the screen? Pin
Ming Luo7-Dec-05 23:54
Ming Luo7-Dec-05 23:54 
AnswerRe: How to display a set of BYTE on the screen? Pin
Ming Luo8-Dec-05 0:30
Ming Luo8-Dec-05 0:30 

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.