how to run socket programme and file management concurrently


 
Thread Tools Search this Thread
Top Forums Programming how to run socket programme and file management concurrently
# 1  
Old 08-28-2006
how to run socket programme and file management concurrently

hi

i have a server socket programme which is running in HP/UX system and
then need to add a function about refreshing memory every miniute

because the socket programme is blocked , i have no idea about this

what should i do
thanks
# 2  
Old 08-28-2006
I'm not too sure what you mean by refresh memory, but am guessing that the problem is that you need to incorporate a new function in your code, and it has to run every minute, but can't because at that point, your program is blocked in an accept call.

Maybe you could setup a signal handling function for SIGALRM, and just run alarm(60) (for one minute) before the accept. Then in your handling function, you can reset the signal handler (am assuming use of 'signal' function here), refresh your memory (or whatever), then run alarm(60) again.

Of course, it is easier said than done, but you could give it a go.
# 3  
Old 08-28-2006
this solution is only at the cost of an extra process and an additional load to the cpu...

fork a process to monitor - or look into memory refresh.. (close all the unnnecessary descriptors ..they are not needed )
while the other process can have a block at accept function call..

blowtorch .. in newer semantics of signals - reregistration of signals are not needed if we are enabling RESTART flag in the sigaction specification itself...
# 4  
Old 08-28-2006
Quote:
Originally Posted by matrixmadhan
blowtorch .. in newer semantics of signals - reregistration of signals are not needed if we are enabling RESTART flag in the sigaction specification itself...
I know that, just that I haven't used sigaction enough to go recommend it to anyone... I don't write too many major C programs, the ones I do, usually put in the 'signal' system call to handle signals, cause its quick (though dirty).
# 5  
Old 08-28-2006
torch,

i didnt have any strings attached with my message (reg sigaction) ... it was just a thought to use the newer semantics ...
# 6  
Old 08-28-2006
Hi benbenpig,

In my opinion you can do refresh after each blocking call, not every minute. Enough that will do. Isn't it so ?

Regards.
# 7  
Old 08-29-2006
Quote:
Originally Posted by blowtorch
I'm not too sure what you mean by refresh memory, but am guessing that the problem is that you need to incorporate a new function in your code, and it has to run every minute, but can't because at that point, your program is blocked in an accept call.

Maybe you could setup a signal handling function for SIGALRM, and just run alarm(60) (for one minute) before the accept. Then in your handling function, you can reset the signal handler (am assuming use of 'signal' function here), refresh your memory (or whatever), then run alarm(60) again.

Of course, it is easier said than done, but you could give it a go.
thanks ,i think this is the solution i need
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to run script concurrently

Hi all, I have one script. Its job is to get 1 file from dirA and 1 file from dirB as parameters for another python script. However, there are a lot of files in both dir A and B, so running this scripts really takes a lot of time. So I wonder if there are any ways that I can do this faster,... (6 Replies)
Discussion started by: yoyomano
6 Replies

2. AIX

Restore and upgrade concurrently

I have serveral servers that are at AIX 6.1 tl4 sp1 and want to move them to new hardware and upgrade them at the same time. Using NIM and sysback images I want to backup the current server with sysback and restore it and upgrade it to AIX 6.1 tl4 sp6 to the new hardware using my NIM server. My... (4 Replies)
Discussion started by: daveisme
4 Replies

3. UNIX for Dummies Questions & Answers

Help to run this socket program in C

i have created two files named server and client then when i run the server program it says the server is waiting(./server 5555) then when i run the client program it says "client error:connection refused" can u plz help me to run it?:( (7 Replies)
Discussion started by: kedah160
7 Replies

4. UNIX for Advanced & Expert Users

connect problem for sctp socket (ipv6 socket) - Runtime fail Invalid Arguments

Hi, I was porting ipv4 application to ipv6; i was done with TCP transports. Now i am facing problem with SCTp transport at runtime. To test SCTP transport I am using following server and client socket programs. Server program runs fine, but client program fails giving Invalid Arguments for... (0 Replies)
Discussion started by: chandrutiptur
0 Replies

5. Programming

How to Run a Linux Command and Redirect its output to a socket in C

I have a Linux socket server program. I need to run the commands sent by the client and return the output to client. Is there a quicker way? I tried with ptr=popen(command, "r"); and then fgets(buf, size,ptr); write buf to socket fgets hangs for me. Now, I would like to know if I can... (3 Replies)
Discussion started by: rajeshomallur
3 Replies

6. Programming

cobol crn programme run on express cobol as .gnt

can i run .crn programme in express cobol which support to .gnt programme .... Plz tell me solution (2 Replies)
Discussion started by: bibi
2 Replies

7. Shell Programming and Scripting

Trimming files concurrently

I have a file which is written by an ongoing process (actually it is a logfile). I want to trim this logfile with a script and save the trimmed portion to another file or display it to <stdout> (it gets picked up there by another process). Fortunately my logfile has a known format (XML) and i... (3 Replies)
Discussion started by: bakunin
3 Replies

8. Shell Programming and Scripting

Running same script multiple times concurrently...

Hi, I was hoping someone would be able to help me out. I've got a Python script that I need to run 60 times concurrently (with the number added as an argument each time) via nightly cron. I figured that this would work: 30 1 * * * for i in $(seq 0 59); do $i \&; done However, it seems to... (4 Replies)
Discussion started by: ckhowe
4 Replies

9. Programming

Run 4-processes concurrently

How can i run a back ground process.... I.e for example by using fork() i need to run seperate 4 background processes.. How can send a process to background ??? (9 Replies)
Discussion started by: ugp
9 Replies

10. Shell Programming and Scripting

Executing multiple Oracle procedures concurrently

I am using KSH with an OS of AIX Version 5.3. From my shell script, that will be scheduled thorugh a CRON, I need to execute 2 Oracle stored procedures concurrently. If we execute them one at a time, the total execution time takes 4 hours or more. Since they are not dependent on each other and... (6 Replies)
Discussion started by: multidogzoomom
6 Replies
Login or Register to Ask a Question