Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


Closed Thread
  Search this Thread
Old 06-23-2005, 01:03 PM   #1
Registered: May 2005
Posts: 275

Rep: Reputation: 30
source code for a php3 server

Does anyone have any source code avaiable for a php3 server that would be comprable to this socket coding done in php5?


if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) < 0) {
		echo "socket_create() failed. Reason: " . socket_strerror($sock) . "<BR>";

	if (($ret = socket_bind($sock, $address, $port)) < 0) {
		echo "socket_bind() failed. Reason: " . socket_strerror($ret) . "<BR>";

	//Start listening on the socket
	if (($ret = socket_listen($sock, 5)) < 0) {
		echo "socket_listen() failed. Reason: " . socket_strerror($ret) . "<BR>";

	//Accept an incoming connection
	if(($client = socket_accept($sock)) < 0) {
		echo "socket_accept() failed. Reason: " . socket_strerror($ret) . "<BR>";

	//Read whatever was just sent, 1024 bytes' worth. Make this however long you need.
	if( false == ($global_string = socket_read($client, 2048))) {
		echo "socket_read() failed. Reason: " . socket_strerror($ret) . "<BR>";
Old 06-24-2005, 09:49 AM   #2
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120
Please do not post the same question in the forums more than once.

Closing thread.

Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Source Code for a simple ftp server and client koodoo Programming 17 07-05-2013 11:48 AM
How to convert Assembly code to "C" source code ssg14j Programming 2 08-01-2005 12:48 PM
Apache source code hack - Server response headers 2.0.49 fireman949 Linux - Software 2 05-24-2004 10:31 AM
source code vishal_iet Linux - General 5 12-26-2002 11:37 AM
Looking for source code sourceman Linux - General 0 05-21-2002 01:58 AM

All times are GMT -5. The time now is 12:39 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration