| Language: | C |
| Category: | Net and Internet |
| Subcategory: | |
| Date: | 2008-07-23 |
| Downloads: | 0 |
| Size: | 57 kb |
| Author: | Michael Flenov |
| Requirements: | |
| Limitations: |
It is a fast and easy to use port scanner with full source codes. It doesn't use any threads to improve productivity.
Threads are a powerful and convenient tool allowing you to implement multitasking within one application. However, they have a disadvantage. Programmers who became familiar with threads start using them needlessly.
I have seen many port scanners using from 20 to 50 threads to scan many ports simultaneously. I am aware that the example from Chapter 4 is very slow and should be speeded up. However, it would be wrong to use that method. You can try to implement scanning with multiple threads if you wish. You'll see that this isn't easy. In addition, threads overload the operating system.
Now you're about to see how a fast port scanner can be implemented without using threads. As you might have guessed, this is done with the asynchronous work with a network. You can create a few asynchronous sockets and start waiting for a connection. Then collect all these sockets in the fd_set set and call the select function to wait for a connection with the server. When it finishes, check all the sockets for successful connections and display the result.
Download Fast port scanner 2.0