02-07-2009
Unfortunately your code is not the easiest to understand nor have we access to all the code. However it looks like you are not destroying semaphones or releasing tdata after use. Perhaps you are running out of semaphores?
10 More Discussions You Might Find Interesting
1. Programming
Suppose i am writing a C program which is going to use Socket calls. I want to use a Unix port for my Socket.
How can i determine a port which is not already in use? (1 Reply)
Discussion started by: Nadeem Mistry
1 Replies
2. Programming
Dear Reader,
Is there any way to check up socket status other than 'netstatus '
Thanks in advance, (1 Reply)
Discussion started by: joseph_shibu
1 Replies
3. Programming
Hello,
I actually try to make client-server program.
I'm using SCO OpenServer Release 5.0.0 and when I try to compile my code (by TELNET) I've got this error :
I'm just using this simple code :
and I get the same error if I use :
If someone can help me,
Thanks (2 Replies)
Discussion started by: soshell
2 Replies
4. UNIX for Dummies Questions & Answers
I have a server and client code.
My server says accept and my client says a connect.
After accept when i print inet_ntoa(cin.sin_addr) by running the client on same machine i get 127.0.01 but accept returns a zero. Now when i try to do a recv from the client the recv never waits for a send. It... (7 Replies)
Discussion started by: abc.working
7 Replies
5. Programming
Hello All,
I have a problem using connect(...) function in C++. I am using SSH from my windows system to connect it to linux server. The program works fine if I run it directly in Linux machine but I need it to run through windows machine.
The function returns -1 and so my program terminates.
... (3 Replies)
Discussion started by: smdhd3
3 Replies
6. IP Networking
Hi,
I typed a few tcp/ip client/server examples from a book and it works - sort of - but I noticed something strange. When I run my server I set it to use port 3001 and the client uses the same port to connect to server. They succeed, but the server prints something that doesn't really make much... (0 Replies)
Discussion started by: idelovski
0 Replies
7. UNIX for Dummies Questions & Answers
in socket programming how can i : Create for example 3 blank files, namely: server, client, network
•Server: act as servers/provider, will receive all requests from different client
•Client: requesters
•Network: middle-layer of communication between server & client
any tips or... (6 Replies)
Discussion started by: kedah160
6 Replies
8. Programming
Why does this socket function only read the first 1440 chars of the stream. Why not the whole stream ? I checked it with gdm and valgrind and everything seems correct...
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include... (3 Replies)
Discussion started by: cyler
3 Replies
9. Programming
I'm using C/ C++ with gcc on Linux. I've a server socket where accept() is called on the socket inside a while() loop. The problem I am facing is that the first call to accept is blocking (i.e., the program waits for the first connection) but as soon as I fork afterwards (so that the child process... (2 Replies)
Discussion started by: jaywalker
2 Replies
10. Programming
Sorry if I posted 2 separate questions.
I'm currently doing socket programming on my current task. As you can see below in the client side. I've tried to do a loop so I will be able to get prompt for input over and over again.
This is the code.
do{
printf("Please your name > ");... (10 Replies)
Discussion started by: aLHaNz
10 Replies
LEARN ABOUT DEBIAN
apache::session::lock::semaphore
Apache::Session::Lock::Semaphore(3pm) User Contributed Perl Documentation Apache::Session::Lock::Semaphore(3pm)
NAME
Apache::Session::Lock::Semaphore - Provides mutual exclusion through semaphores
SYNOPSIS
use Apache::Session::Lock::Semaphore;
my $locker = new Apache::Session::Lock::Semaphore;
die "no semaphores" unless $locker;
$locker->acquire_read_lock($ref);
$locker->acquire_write_lock($ref);
$locker->release_read_lock($ref);
$locker->release_write_lock($ref);
$locker->release_all_locks($ref);
DESCRIPTION
Apache::Session::Lock::semaphore fulfills the locking interface of Apache::Session. Mutual exclusion is achieved through system semaphores
and the IPC::Semaphore module.
CONFIGURATION
The module must know how many semaphores to use, and what semaphore key to use. The number of semaphores has an impact on performance.
More semaphores means less lock contention. You should use the maximum number of semaphores that your platform will allow. On stock NetBSD,
OpenBSD, and Solaris systems, this is probably 16. On Linux 2.2, this is 32. This module tries to guess the number based on your operating
system, but it is safer to configure it yourself.
To set the number of semaphores, you need to pass an argument in the usual Apache::Session style. The name of the argument is NSems, and
the value is an integer power of 2. For example:
tie %s, 'Apache::Session::Blah', $id, {NSems => 16};
You may also need to configure the semaphore key that this package uses. By default, it uses key 31818. You can change this using the
argument SemaphoreKey:
tie %s, 'Apache::Session::Blah', $id, {NSems => 16, SemaphoreKey => 42};
PROBLEMS
There are a few problems that people frequently encounter when using this package.
If you get an invalid argument message, that usually means that the system is unhappy with the number of semaphores that you requested.
Try decreasing the number of semaphores. The semaphore blocks that this package creates are persistent until the system is rebooted, so if
you request 8 semaphores one time and 16 semaphores the next, it won't work. Use the system commands ipcs and ipcrm to inspect and remove
unwanted semphore blocks.
Cygwin
IPC on Cygwin requires running cygserver. Without it, program will exit with "Bad System call" message. It cannot be intercepted with eval.
Read /usr/share/doc/Cygwin/cygserver.README for more information.
Darwin/MacOS X
Darwin and MacOS X may not have semaphores, see <http://sysnet.ucsd.edu/~bellardo/darwin/sysvsem.html>
*BSD
Error "No space left on device" means that maximum number of semaphores is reached. See
<http://www.postgresql.org/docs/7.3/static/kernel-resources.html> for more information.
AUTHOR
This module was written by Jeffrey William Baker <jwbaker@acm.org>.
SEE ALSO
Apache::Session
perl v5.10.1 2010-10-18 Apache::Session::Lock::Semaphore(3pm)