Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > UDP data transfer hangs on recvfrom

Reply
Thread Tools

UDP data transfer hangs on recvfrom

 
 
Jack
Guest
Posts: n/a
 
      02-01-2007
Hi guys,
I can't figure this out.

rec = recvfrom(sdUDP, buf, BUFSIZE, 0, (struct sockaddr
*)&connectChannel, &chanSizeUDP );
while(1){
if (rec > 0){
snt = sendto(sdUDP, buf, rec, 0, (struct sockaddr
*)&connectChannel, chanSizeUDP );
rec = recvfrom(sdUDP, buf, BUFSIZE, 0, (struct sockaddr
*)&connectChannel, &chanSizeUDP );
}
else{
stats();
exit(0);
}
}

The above is the code from a UDP server. The server is suppose to
simply read the incoming data from the buffer and echo it back to the
client. For some reason the code hangs on the recvfrom inside the
while loop. I don't know why this happens... The client sends and
receives the data but the server never exits.

Any ideas..

 
Reply With Quote
 
 
 
 
Thomas J. Gritzan
Guest
Posts: n/a
 
      02-01-2007
Jack schrieb:
> Hi guys,
> I can't figure this out.

[...socket stuff...]
> The above is the code from a UDP server. The server is suppose to
> simply read the incoming data from the buffer and echo it back to the
> client. For some reason the code hangs on the recvfrom inside the
> while loop. I don't know why this happens... The client sends and
> receives the data but the server never exits.


Read here:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

--
Thomas
http://www.netmeister.org/news/learn2quote.html
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to accept a varying amount of UDP packets using recvfrom Randy General Ruby 3 07-08-2009 05:12 PM
how to fill many data strings from socket.recvfrom() lgwe Python 2 11-04-2007 12:47 AM
httplib hangs in read / strace says recvfrom() Michael Bacarella Python 0 09-13-2007 11:57 PM
UDP select()/recvfrom() delay under Windows? David Holroyd Ruby 3 05-25-2005 10:02 AM
Clear hangs up - & hangs up - & hangs up Sue Bilstein NZ Computing 26 03-07-2004 01:33 AM



Advertisments