Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Client recv on TCP/IP

Posted on 2012-04-03
2
Medium Priority
?
473 Views
Last Modified: 2012-04-04
Currently I have a blocking read on a client socket on an AIX 5.3 system on a thread.
Problem is that I have received a message to shutdown, where I need to close the client socket and perform other cleanup.  I have read that the default is blocking read. I have read the man pages and cannot see how one makes it a non-blocking read.  What is the "common" way to manage this kind of problem?  Does one make the read blocking with a wait timeout? Cannot see in IBM manuals how one does this.  Thanks in advance.
0
Comment
Question by:bachan312
2 Comments
 
LVL 40

Accepted Solution

by:
noci earned 2000 total points
ID: 37806928
non-blocking io is done by using a setsockopt call O_NONBLK, then waiting in a select() for one of several filedescriptors and/or a timer
and when select indicates one of your descriptors is ready [ this is communicated using bitmaps ]  you can read/write that descriptor.

This mostly used when non-threaded code is used to implement f.e. a server handling several connections.  [ it predates threading / coroutines  as a way to have some parallelism.

You are using threading, why not just close the socket  and/or kill the thread?
Another thread can handle the shutdown...
0
 

Author Closing Comment

by:bachan312
ID: 37807735
A simple solution.
Thanks
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question