Unix Programming - interrupting send function

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2004 > interrupting send function





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author interrupting send function
Mantorok Redgormor

2004-01-28, 10:35 am

If you are in a particular part of your program
and you are in the middle of a while loop
that is sending data and while sending that
data via a socket, you receive important
data from the server you are sending to, how
can you catch this data being sent from the server
and respond to it while still calling send
in your while loop from another function?

Currently, my program sends data until the while loop
terminates. If data was sent from the server that my
program should react to, it doesn't do so until it finishes
sending data.

Is there anyway around this?



--
nethlek
David Schwartz

2004-01-28, 12:35 pm


"Mantorok Redgormor" <nethlek@tokyo.com> wrote in message
news:41ec7ac0.0401281524.7d91524d@posting.google.com...

quote:

> If you are in a particular part of your program
> and you are in the middle of a while loop
> that is sending data and while sending that
> data via a socket, you receive important
> data from the server you are sending to, how
> can you catch this data being sent from the server
> and respond to it while still calling send
> in your while loop from another function?
>
> Currently, my program sends data until the while loop
> terminates. If data was sent from the server that my
> program should react to, it doesn't do so until it finishes
> sending data.
>
> Is there anyway around this?




There are many ways. One obvious way is to use two threads. Another
possible solution is to use non-blocking I/O with 'select' or 'poll'.

If you're serious about network programming on UNIX, you should
definitely have a copy of Steven's 'UNIX Network Programming'. The third
edition of volume one is now available and covers many different I/O
strategies in detail. It's worth every penny and then some.

DS



Mantorok Redgormor

2004-01-29, 11:34 am

"David Schwartz" <davids@webmaster.com> wrote in message news:<bv9pa3$r2n$1@nntp.webmaster.com>...
quote:

> "Mantorok Redgormor" <nethlek@tokyo.com> wrote in message
> news:41ec7ac0.0401281524.7d91524d@posting.google.com...
>
>
>
>
> There are many ways. One obvious way is to use two threads. Another
> possible solution is to use non-blocking I/O with 'select' or 'poll'.
>
> If you're serious about network programming on UNIX, you should
> definitely have a copy of Steven's 'UNIX Network Programming'. The third
> edition of volume one is now available and covers many different I/O
> strategies in detail. It's worth every penny and then some.
>
> DS



Does the second edition cover many I/O strategies?



--
nethlek
David Schwartz

2004-01-29, 2:35 pm


"Mantorok Redgormor" <nethlek@tokyo.com> wrote in message
news:41ec7ac0.0401291700.313ba06f@posting.google.com...

quote:

> Does the second edition cover many I/O strategies?




I don't remember whether it covers multithreading and the only copy I
have handy is the third edition. Sorry. Anyone?

DS




Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com