J
Jack
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..
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..