Re: [dev] Re: Simple port scanner again (was: GSoC 2010)

From: Dmitry Maluka <dmitrymaluka_AT_gmail.com>
Date: Sat, 6 Mar 2010 16:19:46 +0200

On Sat, Mar 06, 2010 at 01:50:39PM +0300, anonymous wrote:
> On Thu, Mar 04, 2010 at 11:17:08PM +0200, Dmitry Maluka wrote:
> > What is the profit from this abstraction? You call remove_scanned()
> > which moves host from host queue to scanned queue; output() takes hosts
> > from scanned queue and calls hostprint() for them; and you do
> > synchronization. Why not just call hostprint() at the beginning?
>
> There are two threads for two tasks. First thread calculates columns
> lengths and outputs results of port scanning. Second thread probe ports
> and send results to first thread.
>
> Moving every task in one thread is like moving every task in one program.
>
> ...
>
> Rejecting threads is not good idea at all. Threads idea is a projection
> of unix way. Threads are like programs and channels are like pipes. You
> can write everything without them but you better switch to unix instead.

I don't think so. There's a difference between external and internal
interfaces. By unix way, a program does one fundamental task; it doesn't
know how it will be used. All subtasks inside the program serve the main
task; they are implemented in separate functions or modules, and you
know about all their communications, it's your world. Pipes are great
because they are the most simple and efficient way of IPC one can
imagine. Inside a program, the most simple and efficient way of
communication is to call a function.

Threads are good for concurrency. I guess portscan is not the case.
Received on Sat Mar 06 2010 - 14:19:46 UTC

This archive was generated by hypermail 2.2.0 : Sat Mar 06 2010 - 14:24:03 UTC