ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
my client programs sends string to server and server sends same string back to client then client compares if both sent and received string is same or not?
if not same then i am sending same string again to server by using goto.
What i am trying to configure my udpclient work as nonblocking with timeout 5seconds.
how then can i code condition of making sockets nonblocking and only block for 5 seconds here.
Probably the best way is to select(2) or poll(2) on the file descriptor with a timeout of 5 seconds. If the socket has no data after those 5 seconds (you'll need to check the output of select and poll, see the man pages for exact details), act accordingly.
OK Finally i swapped my server and clients codes. But i am unable to use select in my udpserver program that generates string and sends to clients and clients back to server.
Please help me to make following program as UDPSERVER which is actually tcpserver program with select call used.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.