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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.