Jump to content

Creating a socket


Etnika

Recommended Posts

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
$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);
?>

Link to comment
https://forums.phpfreaks.com/topic/259397-creating-a-socket/
Share on other sites

Most systems limit how many file descriptors a process can create, which in turn limits the number of open files or sockets.  Generally this limit is 1024 by default.

 

Just opening a bunch of sockets isn't much of a test really.  Also, use a for loop, not goto.

 

Link to comment
https://forums.phpfreaks.com/topic/259397-creating-a-socket/#findComment-1329850
Share on other sites

Most systems limit how many file descriptors a process can create, which in turn limits the number of open files or sockets.  Generally this limit is 1024 by default.

 

Just opening a bunch of sockets isn't much of a test really.  Also, use a for loop, not goto.

 

The problem is not related to that. I can see that it is opening a single connection, closing it, then opening the next.

I am trying to have the connections all open at the same time.

 

How will a for loop change anything over using a goto loop?

Link to comment
https://forums.phpfreaks.com/topic/259397-creating-a-socket/#findComment-1330148
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.