That is the crappiest job of formatting that I have ever seen! Not only hiding close braces but also hiding entire statements within lines! The worst was this:
where you not only hid the close brace, but you also hid two statements which have nothing to do with the if-statement! And no indentation! Where did you learn to screw up a code listing so horrifically?
break; recvfrom(UDP_socket,b1,sizeof(b1),0,NULL,NULL); printf("\nReply:%s",b1); }
Frankly, my attitude was, "Well, if he wanted us to read his code, then he would have at least tried to make it readable. Since he went out of his way to make it unreadable, then he just doesn't want anybody to read it."
Even after unravelling that mess, I can't see what you're trying to do. For one thing, a very important ingredient is missing: What is the application protocol that the char server is using? From what I can tell, this isn't a sockets problem, but rather a protocol problem. Since UDP is connection-less and hence "send and forget", it falls on the application protocol to do such things as verifying delivery. What does the application protocol tell you that you need to do?
Also, you need to tell us what language you're using. It's obviously not C. Is it C++? Is it C99? Why do you want to try to force us to play guessing games?