LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 12-03-2007, 09:20 PM   #1
BigNate37
LQ Newbie
 
Registered: Nov 2007
Location: Canada
Distribution: Ubuntu 8.10
Posts: 25

Rep: Reputation: 15
Python test script yields 'Connection refused'


I have an issue with my Slackware 12 box. It's running a Python script which is listening to port 2000, and I use another Python script from my Windows XP laptop on the LAN to test it.

Now, If I try to run two instances of my server script, the second fails saying that the address is already in use, so I'm reasonably certain the server script is actually bound to port 2000.
Code:
$ python honeypot.py &
[1] 3047
$ python honeypot.py &
[2] 3048
$ Traceback (most recent call last):
  File "honeypot.py", line 39, in <module>
    server_socket.bind(ss_addr);
  File "<string>", line 1, in bind
socket.error: (98, 'Address already in use')
_
The test script exits with an exception, saying the connection is refused:
Code:
>python test_hp.py
Traceback (most recent call last):
  File "test_hp.py", line 29, in <module>
    client_socket.connect(hp_addr);
  File "<string>", line 1, in connect
socket.error: (10061, 'Connection refused')
>_
I'm not familiar with managing Linux boxes with respect to networking. Is there a software firewall or filter that I need to tweak to let my packets through? I'm hoping it's something as simple as opening the port in a firewall conf file. Or is it possible that my Linksys WRT54GL is blocking traffic internally?
 
Old 12-03-2007, 09:45 PM   #2
BigNate37
LQ Newbie
 
Registered: Nov 2007
Location: Canada
Distribution: Ubuntu 8.10
Posts: 25

Original Poster
Rep: Reputation: 15
I did some reading and found that iptables is a packet filtering tool. I don't think it's running on my box, but I thought I may as well post the kernel modules and processes running on the server.

Code:
$ lsmod
Module                  Size  Used by
snd_seq_dummy           6788  0 
snd_seq_oss            32896  0 
snd_seq_midi_event     10112  1 snd_seq_oss
snd_seq                50640  5 snd_seq_dummy,snd_seq_oss,snd_seq_midi_event
snd_seq_device         10508  3 snd_seq_dummy,snd_seq_oss,snd_seq
snd_pcm_oss            42784  0 
snd_mixer_oss          18048  1 snd_pcm_oss
ipv6                  254496  10 
capability              7304  0 
commoncap               9344  1 capability
lp                     13736  0 
parport_pc             27812  1 
parport                34760  2 lp,parport_pc
pcspkr                  6528  0 
psmouse                39048  0 
serio_raw               9220  0 
tulip                  51616  0 
pata_atiixp             9600  0 
shpchp                 33172  0 
evdev                  11904  1 
k8temp                  8320  0 
i2c_piix4              11276  0 
hwmon                   6404  1 k8temp
ati_agp                10892  0 
agpgart                31432  1 ati_agp
ata_generic             9220  0 
snd_hda_intel          20248  0 
snd_hda_codec         209152  1 snd_hda_intel
snd_pcm                72068  3 snd_pcm_oss,snd_hda_intel,snd_hda_codec
snd_timer              22532  2 snd_seq,snd_pcm
snd                    47204  9 snd_seq_oss,snd_seq,snd_seq_device,snd_pcm_oss,snd_mixer_oss,snd_hda_intel,snd_hda_codec,snd_pcm,snd_timer
soundcore               9824  1 snd
snd_page_alloc         11528  2 snd_hda_intel,snd_pcm
sg                     30364  0 
$ ps -e
  PID TTY          TIME CMD
    1 ?        00:00:01 init
    2 ?        00:00:00 migration/0
    3 ?        00:00:00 ksoftirqd/0
    4 ?        00:00:00 events/0
    5 ?        00:00:00 khelper
    6 ?        00:00:00 kthread
   83 ?        00:00:00 kblockd/0
   84 ?        00:00:00 kacpid
  187 ?        00:00:00 ata/0
  188 ?        00:00:00 ata_aux
  189 ?        00:00:00 ksuspend_usbd
  192 ?        00:00:00 khubd
  194 ?        00:00:00 kseriod
  206 ?        00:00:00 khpsbpkt
  219 ?        00:00:00 pdflush
  220 ?        00:00:00 pdflush
  221 ?        00:00:00 kswapd0
  222 ?        00:00:00 aio/0
  223 ?        00:00:00 jfsIO
  224 ?        00:00:00 jfsCommit
  225 ?        00:00:00 jfsSync
  226 ?        00:00:00 xfslogd/0
  227 ?        00:00:00 xfsdatad/0
  228 ?        00:00:00 ocfs2_wq
  229 ?        00:00:00 user_dlm
  894 ?        00:00:00 scsi_tgtd/0
  928 ?        00:00:00 scsi_eh_2
  929 ?        00:00:00 scsi_eh_3
  930 ?        00:00:00 scsi_eh_4
  931 ?        00:00:00 scsi_eh_5
  959 ?        00:00:00 exec-osm/0
  964 ?        00:00:00 block-osm/0
 1028 ?        00:00:00 kcryptd/0
 1034 ?        00:00:00 kjournald
 1096 ?        00:00:01 udevd
 2456 ?        00:00:00 kpsmoused
 2500 ?        00:00:00 kjournald
 2543 ?        00:00:00 syslogd
 2547 ?        00:00:00 klogd
 2847 ?        00:00:00 dhcpcd
 2902 ?        00:00:00 inetd
 2909 ?        00:00:00 sshd
 2917 ?        00:00:00 acpid
 2925 ?        00:00:00 dbus-daemon
 2930 ?        00:00:00 hald
 2931 ?        00:00:00 hald-runner
 2937 ?        00:00:00 hald-addon-keyb
 2940 ?        00:00:00 hald-addon-acpi
 2942 ?        00:00:00 hald-addon-stor
 2952 ?        00:00:00 crond
 2954 ?        00:00:00 atd
 2957 ?        00:00:00 sendmail
 2960 ?        00:00:00 sendmail
 2992 ?        00:00:00 gpm
 2994 tty1     00:00:00 bash
 2995 tty2     00:00:00 agetty
 2996 tty3     00:00:00 agetty
 2997 tty4     00:00:00 agetty
 2998 tty5     00:00:00 agetty
 2999 tty6     00:00:00 agetty
 3047 tty1     00:00:00 python
 3071 ?        00:00:00 sshd
 3073 ?        00:00:00 sshd
 3074 ?        00:00:00 sftp-server
 3077 tty1     00:00:00 ps
$ _
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Socket Connection Failed: 111 Connection Refused degraffenried13 Linux - General 3 05-31-2009 01:17 AM
Connection was refused when attempting to connect test.hope.local:1158 idowuaugustine Linux - Networking 1 10-16-2007 01:28 PM
DHCP yields "phantom connection" (ipw2200 meets Alice-dsl in Germany) simen Linux - Wireless Networking 3 03-07-2007 11:19 PM
Connection refused on port 81 trying to get to a CGI Script keithdj Linux - Networking 4 10-18-2006 06:11 AM
lp filename yields "cannot open connection to localhost - Connection refused" jjge Linux - General 3 12-28-2003 11:02 PM


All times are GMT -5. The time now is 11:18 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration