Results 1 to 8 of 8
Thread: Creating a socket in PHP
-
03-21-2012, 04:26 AM #1New Member
- Join Date
- Mar 2012
- Posts
- 2
Creating a socket in PHP
I am trying to open as many sockets I can against my mail server to test if it is prown to attack.
I have tried to create 2000 sockets, but I can't seem to get it working and wondering if anyone knows whats going on?
PHP Code:<?php
$counter = 0;
createsocket:
$socket = socket_create(AF_INET, SOCK_RAW, tcp);
socket_connect($socket, "10.0.0.4", 25);
$counter++;
if ($counter != 2000) {
goto createsocket;
}
sleep(240);
socket_close($socket);
?>
-
03-21-2012, 11:43 AM #2Web Hosting Master
- Join Date
- Mar 2010
- Location
- Upstate New York
- Posts
- 1,452
What is the PHP script doing that's telling you it's not working?
████ John Rasri
████ Private Label Live Chat Provider For Resellers
████ GotLiveChat.com
████ White Label/Brand-able live chat software solutions
-
03-21-2012, 11:54 AM #3Lord of live chats
- Join Date
- Jul 2009
- Location
- UK
- Posts
- 1,312
Live Chat Support Software for your Business website - IMsupporting.com
-
03-21-2012, 12:17 PM #4Newbie
- Join Date
- Oct 2011
- Posts
- 27
If you are running linux, which I presume you are then run the following command
sysctl -a | grep somaxconn
-
03-22-2012, 06:51 AM #5New Member
- Join Date
- Mar 2012
- Posts
- 2
-
03-22-2012, 07:23 AM #6Lord of live chats
- Join Date
- Jul 2009
- Location
- UK
- Posts
- 1,312
How about this:
PHP Code:
<?php
$num = "0";
while ($num <= "2000") {
$num++;
$fp = fsockopen("10.0.0.4", 25, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
echo "Connected $num";
}
}
?>Live Chat Support Software for your Business website - IMsupporting.com
-
03-30-2012, 10:15 PM #7Junior Guru
- Join Date
- Jul 2004
- Location
- London, UK
- Posts
- 177
RAW sockets on *any* OS require root/admin user. http://linux.die.net/man/7/raw
Guessing that might be your issue. Also don't use goto, bad.
You may also have a file descriptor issue with that many connections.
-
03-31-2012, 08:31 PM #8Junior Guru Wannabe
- Join Date
- Feb 2012
- Posts
- 54
how about install nodejs and solve your problems
Similar Threads
-
Virtuozzo : getpeername error 88 (Socket operation on non-socket)
By CrownS in forum Hosting Security and TechnologyReplies: 2Last Post: 06-22-2009, 01:22 PM -
Will a socket 478 P4 2.8Ghz HT fit into a socket 775 motherboard?
By Shin Asuka in forum Computers and PeripheralsReplies: 4Last Post: 11-21-2007, 04:28 AM -
Can't write to data socket. Socket error = #10054.
By MartynD in forum Hosting Security and TechnologyReplies: 1Last Post: 10-02-2007, 03:25 AM -
need php developer familier with php socket operations
By bclem in forum Employment / Job OffersReplies: 2Last Post: 09-28-2004, 06:34 PM -
tomcat, ssl, java, and creating a secure socket
By brat_dan in forum Hosting Security and TechnologyReplies: 1Last Post: 07-23-2004, 12:14 AM