LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-27-2010, 04:36 AM   #1
lakshmun
LQ Newbie
 
Registered: Oct 2010
Posts: 17

Rep: Reputation: 0
Unhappy non blocking socket doing other tasks while waiting for connections in C program


Hi

I need to write program for non blocking socket connections.
I have made extensive research but could only get to non blocking READ or WRITE after the connection is established.

What I want to do:

run the program
do a series of tasks (ex: counter printing time on screen)
if there is request for connection, connect
send or receive data

please help.
I am completely blocked

Thank you
 
Old 10-27-2010, 06:39 AM   #2
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
I'd say select() comes to your rescue.

Check out http://beej.us/guide/bgnet/output/ht...et.html#select

http://beej.us/guide/bgnet/
 
Old 11-01-2010, 04:41 PM   #3
lakshmun
LQ Newbie
 
Registered: Oct 2010
Posts: 17

Original Poster
Rep: Reputation: 0
I have solved the problem

hey
thankyou. I have finally solved my problem.

He has used the IOCTL for non blocking, but for me it did not work.
I have used the fcntl function.
Anyways, the example really helped me
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Python: work while waiting for socket connection? hbar Programming 4 10-27-2010 04:57 AM
non blocking socket doing other tasks while waiting for connections in C program lakshmun Linux - Networking 1 10-27-2010 04:56 AM
Waiting for other tasks santiagosilva Linux - Software 2 05-27-2010 12:41 PM
how to close a socket and refuse waiting connections? hboosh Programming 2 01-05-2010 02:59 AM
waiting for X server to begin accepting connections . redhat_zephyr Linux - Newbie 10 07-07-2003 11:27 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration