while infinite loop_sockets constant


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting while infinite loop_sockets constant
# 1  
Old 06-05-2009
MySQL while infinite loop_sockets constant

Hello Every one,

it's requiered to create 'n' number of sockets constant for a hour time. i had my own script to create sockets using this i was able to create sockets and sendind data but using the tool i can maintain 'n' number of sockets for 5 minutes only after sockets are getting reduced to 0 here i have used while infinite loop with sleep 300 seconds this time i have observed more scokets than 'n'( i need 'n' number of sockets for an hour and this number should be same it should not vary).

i am using the following script

while :

do

{code to crete sockets}

sleep 300

done

in the above code for first 5 minutes i was able to create 'n' number of sockets after that sockets number is getting reduced one by one and finally reaching to zero here i am using infinite loop which will run for every 5 minutes as i already stated after 5 minutes number of sockets reducing to n-1,n-2 ................0 in the above infinite loop after 5 minutes number of sockets are n+n-1..............but i need number of sockets are always n.

can somebody help me out here ,if the problem is not clear pls let me know.

kind regards,
Srinu
# 2  
Old 06-05-2009
I am not very clear about your issue.

Anyway for infinite while loop, use the below syntax

while [ 1 ]
do
{code to create sockets}
n=`expr $n - 1` #-- if needed to reduce the value of "n"
sleep 300
continue
done


--Jayan Jayaseelan
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Programming

String Constant C

I wonder string constant exists permanently or temporary. For example, printf("hello, world"); the function printf access to it is through a pointer. Does it mean storage is allocated for the string constant to exist permanently in memory? :confused: (4 Replies)
Discussion started by: kris26
4 Replies

2. Homework & Coursework Questions

Help with infinite loop problem

1. The problem statement, all variables and given/known data: My problem is an infinite loop when i press any other key other then Y or y in the while loop. what i want it to do is return to the normal script outside of it if pressing N or n or keep asking the same question if its any other... (4 Replies)
Discussion started by: Ren_kun
4 Replies

3. Programming

Infinite thread

I created a thread which pings a machine for every 15 seconds. I made my thread function in infinite loop. Main process also in infinite loop and will run for years. I wonder the thread will continue as long as main process continuous or will thread terminates at some point? Is there any life... (6 Replies)
Discussion started by: satish@123
6 Replies

4. Shell Programming and Scripting

Infinite while loop

what is the difference between while:,while true and while false? (6 Replies)
Discussion started by: proactiveaditya
6 Replies

5. Shell Programming and Scripting

infinite while do loop problem

hi all, this is how my scrip looks like #!/bin/sh bindir='/opt/apps/script/bin' datadir='/opt/apps/script/data' dir='/opt/apps/script' while : ; do ls -1rt /opt/apps/script/data/check.txt*|tail -1 > /dev/null 2>&1 if ;then chmod +rwx $bindir/dummy2.sh ... (8 Replies)
Discussion started by: tententen
8 Replies

6. Programming

Is my code in an Infinite Loop?

Production C code compiled without the dash-g option is running, and seems to be in an infinite loop. Is there a way to tell? Is there a diagnostic tool that will report what objects or what lines of code or even what functions are being executed? Or is my best option to kill it with a dump? ... (5 Replies)
Discussion started by: marcus121
5 Replies

7. Shell Programming and Scripting

Constant mirroring

I'm not sure how to best explain what I'd like to do, so let me give an example. I used to work in a department that deals with internet security. This department had an "internal" website (only people in the building can get on it) and an "external" website (anyone in the world can get on it --... (1 Reply)
Discussion started by: sstevens
1 Replies
Login or Register to Ask a Question