Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

socket_create_listen(3) [php man page]

SOCKET_CREATE_LISTEN(3) 						 1						   SOCKET_CREATE_LISTEN(3)

socket_create_listen - Opens a socket on port to accept connections

SYNOPSIS
resource socket_create_listen (int $port, [int $backlog = 128]) DESCRIPTION
socket_create_listen(3) creates a new socket resource of type AF_INET listening on all local interfaces on the given port waiting for new connections. This function is meant to ease the task of creating a new socket which only listens to accept new connections. PARAMETERS
o $port - The port on which to listen on all interfaces. o $backlog - The $backlog parameter defines the maximum length the queue of pending connections may grow to. SOMAXCONN may be passed as $backlog parameter, see socket_listen(3) for more information. RETURN VALUES
socket_create_listen(3) returns a new socket resource on success or FALSE on error. The error code can be retrieved with socket_last_error(3). This code may be passed to socket_strerror(3) to get a textual explanation of the error. NOTES
Note If you want to create a socket which only listens on a certain interface you need to use socket_create(3), socket_bind(3) and socket_listen(3). SEE ALSO
socket_create(3), socket_create_pair(3), socket_bind(3), socket_listen(3), socket_last_error(3), socket_strerror(3). PHP Documentation Group SOCKET_CREATE_LISTEN(3)

Check Out this Related Man Page

LISTEN(2)						     Linux Programmer's Manual							 LISTEN(2)

NAME
listen - listen for connections on a socket SYNOPSIS
#include <sys/socket.h> int listen(int s, int backlog); DESCRIPTION
To accept connections, a socket is first created with socket(2), a willingness to accept incoming connections and a queue limit for incom- ing connections are specified with listen, and then the connections are accepted with accept(2). The listen call applies only to sockets of type SOCK_STREAM or SOCK_SEQPACKET. The backlog parameter defines the maximum length the queue of pending connections may grow to. If a connection request arrives with the queue 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 retries succeed. NOTES
The behaviour of the backlog parameter 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 the tcp_max_syn_backlog sysctl. When syncookies are enabled there is no logical maximum length and this sysctl setting is ignored. See tcp(7) for more information. 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 s is not a valid descriptor. ENOTSOCK The argument s is not a socket. EOPNOTSUPP The socket is not of a type that supports the listen operation. CONFORMING TO
Single Unix, 4.4BSD, POSIX 1003.1g draft. The listen function call first appeared in 4.2BSD. BUGS
If the socket is of type AF_INET, and the backlog argument is greater than the constant SOMAXCONN (128 in Linux 2.0 & 2.2), it is silently truncated to SOMAXCONN. Don't rely on this value in portable applications since BSD (and some BSD-derived systems) limit the backlog to 5. SEE ALSO
accept(2), connect(2), socket(2) BSD Man Page 1993-07-23 LISTEN(2)
Man Page

10 More Discussions You Might Find Interesting

1. Programming

[Problem]Reuse port in BSD socket

I write a chat server using BSD socket, which is listen to an specific port, say 1212. After the chat server is shutdown, I want to execute the program again. But kernel will say that the port 1212 is now unavailable. I have to wait for a while to reuse the port 1212. I am sure there's no... (1 Reply)
Discussion started by: Namely
1 Replies

2. IP Networking

newbie terminology question...

is there a difference between a "port" and a "socket"? (2 Replies)
Discussion started by: trostycp
2 Replies

3. Programming

Multihomed Client

Hi, I am writing a socket program at the moment that uses both of the clients network interfaces. The program tries to create two socket connections to the server over a LAN connection and a GPRS connection. I have tried to update the routing table using the route command but that proved... (0 Replies)
Discussion started by: mhynes
0 Replies

4. Cybersecurity

ports security need help

I wrote a perl socket program which listens on 40011 port number the program works fine. But just a question crossed in my mind I tried to find the answer but I didn't find. Please if anyone have the answer or idea please reply... How to know that which ports are bocked on the UNIX (HP-UX)... (2 Replies)
Discussion started by: zing_foru
2 Replies

5. UNIX for Advanced & Expert Users

socket programming doubt

can we create multiple sockets in a machine with different ip addresses and all port listen to one single port ???? i hav one tool which creates virtual interface and i m using that to create multiple ip addresses in a linux machine and i use thos eip addresses to create multiple sockets and... (1 Reply)
Discussion started by: kic
1 Replies

6. AIX

Port hang issue in AIX Version 5.3

On AIX platform we are having Weblogic 8.1 as the middleware for an application. The application is deployed in Weblogic on AIX platform and the server is having 2 dedicated listening ports for any incoming requests. Output for netstat -an command for the port 30001 is as follows:- tcp4... (7 Replies)
Discussion started by: subharai
7 Replies

7. Programming

creating socket()

deleted (7 Replies)
Discussion started by: satish@123
7 Replies

8. IP Networking

Clarification - Setting socket options at the same time when socket is listening

I need clarification on whether it is okay to set socket options on a listening socket simultaneously when it is being used in an accept() call? Following is the scenario:- -- Task 1 - is executing in a loop - polling a listen socket, lets call it 'fd', (whose file descriptor is global)... (2 Replies)
Discussion started by: jake24
2 Replies

9. UNIX for Dummies Questions & Answers

some basic unix questions pls iam a newbie

what is a assembler what isa interpreter what is a compiler what is a socket what is a port what is meant by listening to a port how we do it how to know version and standard of unix one is using when one is on public access unix account how to see a jobid in... (1 Reply)
Discussion started by: scimitar
1 Replies

10. Red Hat

Too many CLOSE_WAIT connections

Hi, I am running JBOSS 6 ona RHEL5 server put it continuously crashes due to the number of CLOSE_WAIT connections on port 8080. How can I kill the several hundred CLOSE_WAIT connections without killing the actual live "LISTENING" connection? R, D. (2 Replies)
Discussion started by: Duffs22
2 Replies