Programming :: Set Period Of Time To Tcp Connection To Wait For Request Or Respond For Tcp Block Read
Feb 27, 2010
I wanted to know how can I set a period of time to a tcp connection to wait for request or respond for tcp block read. which system call or function I can use? Does any body know a very simple quick and easy reference on web for socket programing that has lots of socket programing examples in it?
I have a server listening on incoming client connections. Once the client establishes SSL connection with the server, the server waits on read() from the client. Only Client can disconnect the connection. I want to have a timer in the server program to wait for x secs after read() and then disconnect the Client connection.
I'm trying to block a site for a certain time.How to Block(deny) perticuler website in certain times of the day , by using squid ? and it seemed promising.I added the lines to my squid.conf
acl office_time time MTWHF 3:00-21:00 acl bad url_regex "/etc/squid/block.acl http_access deny bad !office_time
created a block.acl in the same directory and restarted it.
I am having some trouble with my opensuse 11.3 internet connection for two weeks. After a certain period connection drops while using both NetworkManager and ifup. For info, I write the outputs of some codes.
I'm writing a script that needs to spawn 2 or more processes and wait for their return status. I have a method to do this by waiting on each process individually like this:
Say if i have a domain and i changed the registrar from nameserver1 to nameserver2.For example, if a client side cache isn't cleared, and if the client requests DNS query, would it be possible for the old nameserver1 to respond to the query? would nameserver1 never respond to DNS request?
algorithm:breada input: file system block number for immediate read file system block number for asynchronous read output:buffer containing data for immediate read { if(first block not in cache) { get buffer for first block if(buffer data not valid) initiate disk read } if(second block not in cache) { get buffer for second block) if(buffer data valid) //line 1 release buffer else initiate disk read //line 2 } if(first block was originally in cache) //line 3 { read first block return buffer } sleep (event first buffer contains valid data) return buffer }
Here is an algorithm for block read algorithm. I have problem in line 1: If buffer data is valid why is it releasing the buffer? line 2: If buffer data valid why is it initiating disk read. It should have read directly from buffer? line 3: It should be the first condition as if it is there in cache then it should return it without delay?
I want to know how much CPU time spent on CODE_BLOCK. Since the process executing CODE_BLOCK may be preempted during execution, this CPU time may not be equal to the (wall-clock) time elapsed from the beginning of CODE_BLOCK to the end of it.
i am trying to read in a file 1 line at a time and for some reason it stops printing out at about line 62,000.
i am doing this: Code: while(fgets(c0, 1085, fstream0) != NULL)
but after about 62,0000 lines it stops printing. no seg-fault, no core dump. it just stops printing to the terminal then returns me to the command line after a couple of minutes. as a hack i am doing split -l 50000 on the input and calling my program 5 times.is there some limitation on fgets that i am not understanding ?
I installed ubuntu 10.0.4 TLS version and my desktop freezes after a period of inactive time: the screen doesn't change and the apps do not response. It will resume after any key-stroke or mouse action. Is it a feature of 'power-saving' or something else? I need my ubuntu keep 'alive' all the time.
Now i am writting one bash script. in that my requirement is i need to create one directory and that the directory details to be stored in one file Ex. date/time and all in one file. after that i need to delete the folder automatically exactly after 3months. between these time period in 2month itself i need to send one mail to admin "regarding this still one month only more to delete the folder" . is it possible to do like that date calculation in script.
I am trying to read the /proc/net/tcp6 file of a huge server (chat server) for monitoring the tcp6 connection states.
My server's tcp6 file has more than 26000 lines. For monitoring the server connections, my monitoring tool has to read the /proc/net/tcp6 file quickly in a regular interval (5 secs) and process. Presently it takes minimum 6-7 seconds for reading the whole file.
My tool can able to read the normal file (26,000 lines) less than 1 second, but it is not possible to read the same size of proc file.
I have 2 questions:
1) Why proc file takes more read time than normal file?
2) Is there any way to read the /proc/net/tcp6 file more quickly?
I just reinstalled, and can't get the setting set right so that my display does not shut off after a certain period of time. It is shutting off after a while of inactivity, and I do not want it to.
I currently have fedora 15 installed along side windows 7 on my acer aspire d250. So far it runs great, however I was wondering if there is a way to make fedora 15 hibernate after being in suspend for a period of time, just like windows 7 does. This make sense to me as there is no point in wasting battery life if i can hibernate, but I don't want to hibernate all the time, just suspend for a period of time, like 2 hours, in case I need my netbook again i have quick access to it.
Im looking for an app pr line of code that could let me observe a process, save the info in a number of variable and then put the gathered info on a file.
Ive been trying with variations of top but no luck. I am running several CentOS virtual servers, VM is 2gb ram 2 processor.
Maybe a script that works over a specified amount of time while writing lines with the info on a text file so at the end i can have a sort of table with the data.
The thing is Im going to stress test the server and I would like to have the data to make some statistics.
We are using Red Hat linux 4 .We blocked certain sites through squid for certain ip address.we want to unblock these sites in particular interval ,ie during noon time and after 4.00 pm.
Here we have given
In the sites.txt we have given the names the of those sites that should be blocked
The problem is to unblock sites in sites.txt, for particular intervals
I am writing a C program which reads data over serial port. While reading data, if I send my data(which is a 13 byte structure) periodic with a period of 1 second for 10 times I read it without problem and I read the data 10 times as I sent and as I expectBut if I send data continuousuly(without any time interval between each sending) 10 times I can only read 1 of them(I can only read it once).
I install Opensuse 11.4 on KDE environment then I changed to XFCE. I don't know how to configure for computer auto shutdown after a period of time don't use it.
I am running Karmic on my laptop, and I have three 1.5 TB external hard drives which I swap between frequently. My problem is that if I leave the drives in, and do not access them for a period of time, they become inaccessible, i.e. I will click on the icon on the desktop or in Places, and it will tell me there is no device mounted, even though I was using it fine just an hour before.
i have a feeling that it is because the USB drives spin down after a period, and Ubuntu detects them as being 'disconnected'. Would it help if I added individual entries for each in fstab?? Or do I need to adjust some settings elsewhere?
EDIT: If this information helps, the HD's are all Seagate Expansion drives, formatted to ext4.
My power went out for an extended period of time and now my graphics are messed up. I started my computer up and I only can get 640x480, so I was trying to reinstall the drivers but the nvidia drivers on the repositroy do not make sense as far as what goes with what, or descriptions of them. I downloaded the driver off nvidias website instaled it. It went to my desktop same problem.
I skipped over Jaunty on my main desktop because Intrepid had been working perfectly for so long. Finally took the plunge to Karmic, and have had major instability problems. I cannot trace them to any particular program I am using. At first it seemed related to power management, since it would lock up every time it had a period of extended inactivity. I have disabled ACPI in my BIOS (I think), and any power management settings I could find in gnome to try to troubleshoot. That seems to have helped, but it still happens semi-regularly, sometimes when I am in the middle of using it. I have tried checking logs and googled anything that seemed important. ie a message in kern.log reads: Clocksource tsc unstable
I'm not sure if this belongs in the Server or Networking section of the forums. Anyway, last month I upgraded my server to Ubuntu 10.04 LTS. Since then, I've had a recurring problem wherein after a certain period of time, the server stops accepting network connections. Ubuntu 10 will continue to reject network connections until someone logs into the server locally, after which time network connectivity is restored and the cycle begins anew. Essentially, the server goes into a "half sleep mode". I say half because the computer is still on and the fans are running.
I've done some searching around various forms and initially figured this issue was related to problems with the Network Manager service (https://bugs.launchpad.net/ubuntu/lu...er/+bug/524454), so I removed the service altogether. However, this problem is still occurring.
I've poured over /var/log/messages and /var/log/syslog, but have noticed no irregular behavior. Has anyone else experienced this issues? I'd rather not resort to downgrading back to Gusty Gibbon if I can help it.
I am happy to provide more information if its needed
The CPU frequency scaling monitor won't stay at 800mhz after reboot or a certain period of time. My goal is to always have my dual core CPU locked at 800mhz to have it run cooler. I'm running Ubuntu 10.10 on my toshiba u300 laptop.
I'm using centos 5, kernel 2.6.18-164.11.1.el5I have occasional server network problems (the NIC driver will basically crash/restart causing no connectivity for a period of time) due to the marvell sky2 NIC driver being a problem, as discussed here: This essentially means the server is unreliable when under any kind of reasonable load, to put it mildly.Worse still, the driver problem has not been resolved in 2.6.18.x - but it seems to have been resolved in the latest Linux kernels.I really don't want to compile the kernel from source, etc, but it looks like I may have no choice.Is there a repo which has a pre-compiled 2.6.20+ or 2.6.30+ kernel which I can use,
My server gets ddos attacks. I dig into access logs and I saw that attacker ips doesn't have valid requests headers, like their browser application info or requested url info.I want to close those connections immediately, and if it's possible block those ips for a time period.Can I do that with Apache and iptables?I searched on the internet but couldn't find useful results. Probably couldn't search for the right words.
I am using a perl script which uses curl in the background to download files from rapidshare premium,one file at a time. I wanted to know is it possible to use curl and spawn multiple connection at a time,to download the same file in multiple parts?? I don't seem to find an option in curl which does that.