12-30-2003
Correct. But be sure to use POSIX threads (Pthreads)
There are plenty of examples available on the Web
showing how to use POSIX pthreads to listen for
and handle incoming connections.
- Finnbarr
9 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
well, my internet brakes down every day because of my server, i don't have troubles with RAM or anything i think... that problem started since i am running an unrealircd server...
well, my internet brakes down and when i try to access the inside ip from the server on http port 80, it says that:... (2 Replies)
Discussion started by: AiRkO
2 Replies
2. Programming
Try to solve this.....It's a nice program.....
#include<stdio.h>
void change()
{
/*Write something in this function so that the output of printf in main function should give 5 . Do not change the main function */ }
void main()
{
int i=5;
change(); (9 Replies)
Discussion started by: Baba B. Saheb
9 Replies
3. UNIX for Advanced & Expert Users
Hi, all,
The following commands could compute the 10 most frequent bigrams from a input sequence which is in a file infile.
I would like to know whether there is somebody who can use only two unix commands to do the same work.
--------------------
tr " " "\012*" <infile >out1
tail +2... (3 Replies)
Discussion started by: vicky20000
3 Replies
4. UNIX for Advanced & Expert Users
Hi!
My unix os version is OSF1 CP1 V4.0 878 alpha.
It startup normally but it restarts within 5 sec.
I would like to know how to solve .
Please reply to me.
Thanks .
akzin (2 Replies)
Discussion started by: akzin
2 Replies
5. IP Networking
I have a Red Hat linux server X on a x.x.0.0 network. This machine also has to communicate with another server Y on a network called y.y.0.0
Server X has two network interfaces.
eth0 is configured on the x.x.0.0 network and has a default gateway on the x.x.0.0 network.
In order to... (4 Replies)
Discussion started by: soliberus
4 Replies
6. UNIX for Advanced & Expert Users
I have a file process.txt
I wanted to just grab data in "process" column.
Name process process_id status
Adminserver adminserver 22669 Running
Browser Engine browserengine ... (7 Replies)
Discussion started by: soemac
7 Replies
7. Shell Programming and Scripting
Take a look on this code:
#!/bin/sh
currentpath=`pwd`
if ; then
#Normal user
if ; then
"$currentpath"/.cleaner
else
./runit
fi
else
#Root user
if ; then
rm -r /some
fi
mkdir /some
cd /home/
echo "`ls --group-directories-first -1`" > /some/allusers
cat /some/allusers | sed 's/... (17 Replies)
Discussion started by: hakermania
17 Replies
8. Shell Programming and Scripting
Hi all,
I have a file.....
I want to print 2nd column arranged according to order of first column, present in second file.....
So, the output should be:
I am using following code:
awk 'NR==FNR{a=$2;next}{print a?a:"ABSENT\t"}' file1 file2
But, it seems that the... (3 Replies)
Discussion started by: CAch
3 Replies
9. Shell Programming and Scripting
Hello,
I would really appreciate some help into approaching this problem:
- i have a random txt file with x lines and y rows following this pattern:
ex:
ip1 | user1 | command
ip2 | user2 | command
ip3 | user3 | command
- i need to telnet/ssh into these ip's, login with... (7 Replies)
Discussion started by: catalinstk
7 Replies
LISTEN(2) Linux Programmer's Manual LISTEN(2)
NAME
listen - listen for connections on a socket
SYNOPSIS
#include <sys/types.h> /* See NOTES */
#include <sys/socket.h>
int listen(int sockfd, int backlog);
DESCRIPTION
listen() marks the socket referred to by sockfd as a passive socket, that is, as a socket that will be used to accept incoming connection
requests using accept(2).
The sockfd argument is a file descriptor that refers to a socket of type SOCK_STREAM or SOCK_SEQPACKET.
The backlog argument defines the maximum length to which the queue of pending connections for sockfd may grow. If a connection request
arrives when the queue is full, the client may receive an error with an indication of ECONNREFUSED or, if the underlying protocol supports
retransmission, the request may be ignored so that a later reattempt at connection succeeds.
RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately.
ERRORS
EADDRINUSE
Another socket is already listening on the same port.
EBADF The argument sockfd is not a valid descriptor.
ENOTSOCK
The argument sockfd is not a socket.
EOPNOTSUPP
The socket is not of a type that supports the listen() operation.
CONFORMING TO
4.4BSD, POSIX.1-2001. The listen() function call first appeared in 4.2BSD.
NOTES
To accept connections, the following steps are performed:
1. A socket is created with socket(2).
2. The socket is bound to a local address using bind(2), so that other sockets may be connect(2)ed to it.
3. A willingness to accept incoming connections and a queue limit for incoming connections are specified with listen().
4. Connections are accepted with accept(2).
POSIX.1-2001 does not require the inclusion of <sys/types.h>, and this header file is not required on Linux. However, some historical
(BSD) implementations required this header file, and portable applications are probably wise to include it.
The behavior of the backlog argument on TCP sockets changed with Linux 2.2. Now it specifies the queue length for completely established
sockets waiting to be accepted, instead of the number of incomplete connection requests. The maximum length of the queue for incomplete
sockets can be set using /proc/sys/net/ipv4/tcp_max_syn_backlog. When syncookies are enabled there is no logical maximum length and this
setting is ignored. See tcp(7) for more information.
If the backlog argument is greater than the value in /proc/sys/net/core/somaxconn, then it is silently truncated to that value; the default
value in this file is 128. In kernels before 2.4.25, this limit was a hard coded value, SOMAXCONN, with the value 128.
EXAMPLE
See bind(2).
SEE ALSO
accept(2), bind(2), connect(2), socket(2), socket(7)
COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2008-11-20 LISTEN(2)