Re: To Cense about Signal ()

new topic     » goto parent     » topic index » view thread      » older message » newer message

Sorry about the day late response but i was in no shape yesterday to give you
any response even though i did check my mail.

On Wed, 15 Nov 2000, Kayhlan wrote:
>> First off, let me start by saying I will name every child I have from this
>> day forward after  you, with
>> different middle names of course, as it could get really confusing otherwise.
>> . .  .
>>
>> Now that I've done my schmoozing, there is a comment and a couple of
>> questions left:

hehe, all good
 
>> Your suggestions on Send() worked perfectly and I understand the wrapper for
>> signal() that you wrote. My

Well actually Jeff Fielding wrote it/ helped me with it and i just *slightly*
modified it for my use, ill pass any credit onto him for it.

>> question or two about it is, considering my previous example of write(now
>> send), assuming that the SIGPIPE
>> would be returned before send() has a chance to return -1, when would you run
>> the signal()? Is this
>> something that needs to be run only once, and it will work for the duration
>> or does it need to be called
>> before each instance of send()? 

Well according to the man page for signal, the general answer to both your
questions is, yes. I know that does not help so im going to clearify some
stuff. in C, if you include <signal.h> then yes, you have to call signal
everytime before you make the call to send. if you include <bsd/signal.h> you
do not. Now by default you are using <signal.h> so you would have to make this
call before every call to send( ).  As long as you make the call to signal( )
before send( ) gets the SIGPIPE signal you are fine. ( unless a previous call
to send has "used" your last call to signal, then you must call signal again )

>> The other question is, once the Signal() is caught, and the specified
>> routine run, do you have any idea if the main program will continue the
>> send() or does it skip to the next
>> line in the sending routine?

Well that can all depend on what you put in the routine to handle the signal,
this i am not too familiar with, so again ask a C ( and linux ) guru about how
to make an effective routine handler.

>> In other words, If I send() "message" signal() should direct the call_back to
>> run a simple routine at the
>> beginning of the message. Does it continue to try to send the message, thus
>> running signal() for
>> length("message") times?

I do not think this will happen.

>> Any more help at this point might seem a tad greedy but your message came
>> literally five minutes after I had
>> given up all hope and was opening up my many C manuals to begin re-coding my
>> game yet another time.

As long as im not coding your MUD and then you slap your name on it i dont
think your being greedy.

>> Thank you again,  Cense, you've been a life saver.

no problemo capitain.

>> Kayhlan

Oh, just one last thing, if you would do me a favor. I am still working on my
socket wrapper and i through away my old code to wrap "poll( )" so i was
wondering if you could send me a little snippet of your code around where you
call poll so that i can easily wrap the mutha?

-- 
evil, corruption and bad taste
^[cense]

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu