getting data from a port in use

Grant Edwards grante at visi.com
Tue Feb 1 22:32:56 EST 2005


On 2005-02-02, Dana Marcusanu <dmarcusanu at yahoo.com> wrote:

> Yes. It hangs at accept. I always end up doing end task
> because it never passes the "accept" statement.

And you're sure that somebody tries to initiate a connection
after your program has gotten to the accept() line? 

> When I set the port I use netstat (netstat -bn) to get the
> ports that are in use.

What do you mean by  a port being "in use"?  Is there another
program already waiting for a connection on the port?  You keep
repeating the bit about "ports in use", but that phrase is too
vague.  Do you mean there is already an established connection
that uses that port?  If that's what you mean, it doesn't
matter one way or another.  What matters is whether there's
another program already bound to that port and listening for
new connections.

As I've already said: if you're trying to get data from already
established connections, you can't do it using accept.  You
have to use the pcap library.

You're going to have to accurately describe what you're trying
to do, or none of us are going to be able to help you.

-- 
Grant Edwards                   grante             Yow!  HERE!! Put THIS
                                  at               on!! I'm in CHARGE!!
                               visi.com            



More information about the Python-list mailing list