Solved

Client recv on TCP/IP

Posted on 2012-04-03
2
464 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
noci earned 500 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Suggested Solutions

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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

734 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