Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

socket-context-options(3) [php man page]

SOCKET-CONTEXT-OPTIONS(3)						 1						 SOCKET-CONTEXT-OPTIONS(3)

Socket context options - Socket context option listing

	Socket context options are available for all wrappers that work over sockets, like tcp, http and ftp.

	      o $bindto
		-  Used to specify the IP address (either IPv4 or IPv6) and/or the port number that PHP will use to access the network. The syntax
		is ip:port for IPv4 addresses, and [ip]:port for IPv6 addresses. Setting the IP or the port to 0 will let the system choose the IP
		and/or port.

	      Note

		      As FTP creates two socket connections during normal operation, the port number cannot be specified using this option.

	      o $backlog
		- Used to limit the number of outstanding connections in the socket's listen queue.

	      Note

		      This is only applicable to stream_socket_server(3).

       +--------+-----------------+
       |Version |		  |
       |	|		  |
       |	|   Description   |
       |	|		  |
       +--------+-----------------+
       | 5.3.3	|		  |
       |	|		  |
       |	|  Added backlog. |
       |	|		  |
       | 5.1.0	|		  |
       |	|		  |
       |	|  Added bindto.  |
       |	|		  |
       +--------+-----------------+
       Example #1

	      Basic $bindto usage example

	      <?php
	      // connect to the internet using the '192.168.0.100' IP
	      $opts = array(
		  'socket' => array(
		      'bindto' => '192.168.0.100:0',
		  ),
	      );

	      // connect to the internet using the '192.168.0.100' IP and port '7000'
	      $opts = array(
		  'socket' => array(
		      'bindto' => '192.168.0.100:7000',
		  ),
	      );

	      // connect to the internet using the '2001:db8::1' IPv6 address
	      // and port '7000'
	      $opts = array(
		  'socket' => array(
		      'bindto' => '[2001:db8::1]:7000',
		  ),
	      );

	      // connect to the internet using port '7000'
	      $opts = array(
		  'socket' => array(
		      'bindto' => '0:7000',
		  ),
	      );

	      // create the context...
	      $context = stream_context_create($opts);

	      // ...and use it to fetch the data
	      echo file_get_contents('http://www.example.com', false, $context);

	      ?>

PHP Documentation Group 												 SOCKET-CONTEXT-OPTIONS(3)

Check Out this Related 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)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

I can't connect to the internet???

I have installed Mandrake 8.0...however I can't seem to connect to the internet while using it. I have dial up upstream and cable downstream (if that helps). Can anyone help me out??? Thanks. (14 Replies)
Discussion started by: justchillin
14 Replies

2. UNIX for Dummies Questions & Answers

Cannot connect to the Internet

I running HPUX 11.0, Netscape gives me an error "Unable to locate Server" when using a www.something.com address. If I use an IP address I get past the router and onto the Internet. My workstation can get to the Router @ 192.168.0.1 and also it's local APACHE server. I have DHCP enabled... (8 Replies)
Discussion started by: johnalt
8 Replies

3. UNIX for Dummies Questions & Answers

solaris internet connection

Hi everyone, I just installed Solaris 10 in my PC. However, once I finished installing it, I lost my internet connection. When I switch to windows, the internet can run smoothly. Does anyone know how to set up internet connection in Solaris ? I am so sorry, I am new in UNIX (7 Replies)
Discussion started by: qqq
7 Replies

4. Solaris

Another person that needs Internet help

Ok i have a router, which my sparc 5 is connected to. I can acess the router webpage (192.168.0.1). But I cant access the internet. When i use sys-unconfig i enter my ip address fine then i click none for when it asks me for DNS info because I dont have a domain. I was told i can manually change... (10 Replies)
Discussion started by: vikster007
10 Replies

5. Solaris

How to connect Solaris 10 to the internet ?!

ive installed a fresh copy of solaris 10 on a E3500 Server machine, i gave it a static IP address , 192.168.1.15 its a test server in our office (small office) we are using LINKSYS as our internet router and DHCP as well .. its IP is 192.168.1.1 and ive added this IP as Default route on the server... (9 Replies)
Discussion started by: mduweik
9 Replies

6. UNIX for Dummies Questions & Answers

Redhat DNS Entry

I have a installed Redhat Linux v5 on a new HP Pavillon PC. It has a dual boot with Vista. Booting from Vista, I can connect to the internet. However with Redhat I cannot connect to the internet. I looked at the /etc/resolv.conf file in Redhat and there is no DNS entry there. From where do I... (28 Replies)
Discussion started by: AnilAnand
28 Replies

7. Solaris

how to configure my network to use the internet

i have a router from my isp provider 02. my internet works fine in windows but i am unable to use internet in solaris. when i tried ifconfig command i was able to see the lo0 which is my laoopback adapter. pls can someone advice. (7 Replies)
Discussion started by: seyiisq
7 Replies

8. UNIX for Dummies Questions & Answers

Socket programming

in c socket programming, how can I send and received on the same port? (7 Replies)
Discussion started by: Peevish
7 Replies

9. Shell Programming and Scripting

monitoring various things (mainly activity) on different unix boxes

Hi there, I want to ask you guys what you think about my problem. I work as a sysadmin on about 7000 workstations or so and to save money and energy, we've decided to switch off as many workstations as possible during the night (probably by shutting it down by cron and power it on by... (8 Replies)
Discussion started by: albator1932
8 Replies

10. Shell Programming and Scripting

Need the line number of failed records

Hi awk Gurus, I have file as below : file1.txt 7000,2,1,6 7001,2,1,7 7002,2,1,6 7003,1,2,1 file2.txt 7000,john,2,0,0,1,6 7000,john,2,0,0,1,7 7000,john,2,0,0,1,8 7000,john,2,0,0,1,9 7001,elen,2,0,0,1,7 7002,sami,2,0,0,1,6 7003,mike,1,0,0,2,1 (13 Replies)
Discussion started by: arunshankar.c
13 Replies

11. UNIX for Dummies Questions & Answers

Routing issue - local vs LAN

hi guys suse 11 SP1 x64 I have a server (4 NIC ports 192.168.100.100-103) that connects point to point to a storage device (same thing 4 ports 192.168.110.100-113) but this server connects to normal LAN 10.6.100.x - gateway 10.6.100.1 the issue is when testing connectivity to the storage... (7 Replies)
Discussion started by: karlochacon
7 Replies

12. IP Networking

How to connect internet in Linux OS

How to enable internet on my Linux OS My OS: Red Hat Fedora Release 9 (Sulphur) version: 2.6 I have to connect via my Nokia cell phone via cable. This way only I had been using internet on my Windows OS. If any software is required to install on my UNIX for internet, then I don't have any. If... (14 Replies)
Discussion started by: ravisingh
14 Replies

13. IP Networking

Unable to connect to internet on slackware 14.1 (hathway connection)

Hi, I have a wired internet connection of hathway provider. I would like to use the connection on my desktop as well as my laptop. My desktop pc has windows 7 and yesterday I installed slackware 14.1 (full installation) on my lenovo 3000 n100 laptop. Previously I had slacko puppy 5.7... (7 Replies)
Discussion started by: pinakbheed
7 Replies

14. SCO

Connecting to the internet

Hi, I have a router, 192.168.1.1, and an internet router, 10.0.0.138. I have connected the server to the 1st router and assigned it a IP address of 192.168.1.1. I can ping both routers successfully but I have no access to internet. Any suggestions? sco5.0.7 (11 Replies)
Discussion started by: juan.navarrete
11 Replies

15. Linux

Kali cannot find WiFi card.

After installing the latest version of Kali on my Lenovo S21E laptop, I cannot access the internet. wlan0 does not show up in ifconfig and I cannot connect to the internet. If you need any other additional information, I will provide it. Thank you kindly. (8 Replies)
Discussion started by: Hotrod22
8 Replies