|
-
October 27th, 2004, 12:38 AM
#1
dont want blocking receive message
Hi,
I'm programming a client for a chatting program and I had a question about the client, when it receives messages. My Client is allowed to have only one connection with the server. I have many receive function calls but i know when they will be executed so i've called them at appropriate location in the code, except for broadcast message which server can send any time to the client.
Now, i can't just call the receive message function as its a blocking call and any code below it wont' be executed....
I can't use the 'select' function either as it creates new socket descriptors and new connections and i'm allowed to have only one connection with server...
I can't use fork to invoke another thread cuz i'll have receive calls (like i mentioned earlier) both in the child and parent process so when a server sends message either running thread can get it. However, i only want the receive call in the parent to be executed, whose purpose is to catch broadcast messages....
Someone told me to use fcntl() however, i'm having problems understanding how it functions and what its purpose is :S...if someone can plz explain that or give a link for a good tutorial on it, besides the man pages or if there's a better solution to the whole problem
Thanks a lot,
Samar
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|