Etnika Posted March 21, 2012 Share Posted March 21, 2012 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 More sharing options...
kicken Posted March 21, 2012 Share Posted March 21, 2012 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 More sharing options...
Etnika Posted March 22, 2012 Author Share Posted March 22, 2012 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 More sharing options...
Etnika Posted March 22, 2012 Author Share Posted March 22, 2012 bump Link to comment https://forums.phpfreaks.com/topic/259397-creating-a-socket/#findComment-1330361 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.