[tg] Traffic Generator: UTP server question

Andro Galinovic (ZG/ETK/DR) andro.galinovic at ericsson.com
Tue Aug 1 07:47:59 PDT 2006


Barbara Denny wrote:
> Hi,
>
> Yes.  You can say wait for so much time on
> the receive side and then the process will
> end.  For example,
>
> at 1.1 wait 60 
>
> This causes tg to end 60 seconds after the
> time requested by the at action; i.e. about
> 61.1 seconds after the setup. (or 1:30 for 
> one minute 30 seconds, etc).
>   
YES! Thank you!!! Seems logical now :)
> From your original message I did not realize
> you had modified tg to make it end. I looked at
> the code and saw the line you mentioned below so
> I didn't see how it could have exited on its 
>   
Yes a did. But only by decreasing the timeout.
    The trick is this, datagram tg server sets read as a nonblocking
operation, so when there is no data to read "recvfrom" returns "-1"
which triggers a break in the else statement. After the break other
descriptors are checked for "usability" (are they in use), if no usable
descriptors are found the timeout is checked. If "gettimeofday" is >=
endtout the server stops (return(0)).
    I didn't change the timeout in the tg.y because at that point is not
clear (to my, anyway) for how long the sever should be active. By
changing the timeout every time the loop detects no data I'm sure that
the server wouldn't stop while there's data coming in.
    In spite of all of that I'm gonna use "wait x" way of stopping the
server :)

bye

                         Andro

> own.
>
> barbara
>
> --- "Andro Galinovic (ZG/ETK/DR)"
> <andro.galinovic at ericsson.com> wrote:
>
>   
>> Hi
>>
>> What do you meed "you can specify a time literal
>> after the wait command
>> in the receive side script"?
>> If I have a receiver side script :
>> on 0:25 udp 0.0.0.0.4400 server
>> at 1.1 wait
>> than tg enters wait state 1.1. s after the start
>> time synchronization
>> boundary, if I'm not mistaken. Can I specify and say
>> "wait for x seconds
>> and than die"?
>>
>> To answer your question ("how long it took for tg to
>> shutdown on its
>> own?") the answer is very long... in the line 1052
>> of the file tg.y the
>> timeout is specified with a  absolute time
>> "cur_tg->stop_before.tv_sec =
>> 0x7fffffff;" which represent some time in the year
>> 2038. As I said in my
>> previous e-mail I added two lines which make the
>> timeout 30 seconds from
>> the current time every time there's nothing more to
>> read i.e. recvfrom
>> returns < 0  and with errno == EWOULDBLOCK.
>> That seems to fork fine, for now :)
>>  
>>
>>                            Andro
>>
>>
>>
>> Barbara Denny wrote:
>>     
>>> Hello Everyone,
>>> ...
>>>
>>> Of course, I should have mentioned you can
>>> specify a time literal after the wait command
>>> in the receive side script. This will cause
>>> an automatic shutdown. You need to make sure 
>>> you have left enough time for the send side to 
>>> finish. If you don't, errors will be
>>> recorded in the send side log (errno 111). 
>>>
>>> Andro, can you let me know how long it took
>>> for tg to shutdown on its own? 
>>>
>>> barbara
>>>   
>>>       


More information about the tg mailing list