473,320 Members | 1,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

I CAN connect socket to any localhost port but I shouldn't be able to

qvx
Hi,

I don't have server listening on port 8084 but I can open socket to it
(and to many other ports, tested for all<8000)

import socket
def test(port):
af, socktype, proto, canonname, sa =
socket.getaddrinfo('localhost', port,
socket.AF_INET, socket.SOCK_STREAM)[0]
s = socket.socket(af, socktype, proto)
s.settimeout(1.0)
s.connect(('localhost', port))
s.close()

# This doesn't throw socket.error, it happily finishes
for x in range(1, 8000):
test(x)
Thanks,
Tvrtko
Jul 29 '08 #1
2 1718
En Tue, 29 Jul 2008 14:56:08 -0300, qvx <qv*****@gmail.comescribi�:
I don't have server listening on port 8084 but I can open socket to it
(and to many other ports, tested for all<8000)
Your example fails -as expected- on my PC running Python 2.5.2 + Windows
XP SP2. It may be something specific to your setup or your platform.

pytest(8084)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 5, in test
File "<string>", line 1, in connect
socket.error: (10061, 'Connection refused')
--
Gabriel Genellina

Jul 30 '08 #2
qvx
On Jul 30, 4:48*am, "Gabriel Genellina" <gagsl-...@yahoo.com.ar>
wrote:
En Tue, 29 Jul 2008 14:56:08 -0300, qvx <qvx3...@gmail.comescribi :
I don't have server listening on port 8084 but I can open socket to it
(and to many other ports, tested for all<8000)

Your example fails -as expected- on my PC running Python 2.5.2 + Windows *
XP SP2. It may be something specific to your setup or your platform.

pytest(8084)
Traceback (most recent call last):
* *File "<stdin>", line 1, in <module>
* *File "<stdin>", line 5, in test
* *File "<string>", line 1, in connect
socket.error: (10061, 'Connection refused')
--
Gabriel Genellina
Thanks for confirmation. There is a similar function in CherryPy
server which won't start anymore but it used to. I am currently
examining Windows and any recently installed software.
--
Tvrtko
Jul 30 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Mr Dygi | last post by:
Hi, PHP 4.3.4 installed manually from package *.zip and Apache 2. I have a problem with this simple code: <?php $link = mysql_connect("127.0.0.1","","") or die("Could not connect: " ....
1
by: Gareth Crispin | last post by:
Good afternoon, I'm rewriting a piece of perl code in C++ that simply checks availability of a port. It's fairly simple, and returns UP, DOWN or NODNS. This works great, and is just what I...
1
by: jiing | last post by:
Now let me describe what I have done and my purpose: Originally, I want to user ports to install phpBB But I found that phpBB doesn't support mysql 5.x (but the ports installed mySQL 5.0.0...
7
by: Michi Henning | last post by:
Hi, I'm using a non-blocking connect to connect to a server. Works fine -- the server gets and accepts the connection. However, once the connection is established, I cannot retrieve either the...
14
by: DaTurk | last post by:
I am makeing a Multicast server client setup and was wondering what the difference is between Socket.Connect, and Socket.Bind. It may be a stupid question, but I was just curious. Because I...
0
by: mmcgee00 | last post by:
Hi, Currently, I am trying to get different service banner by connecting to different ports using python (code below). The versions I am working with are python 4.2.1 and fedora core 4. I am...
2
by: 7stud | last post by:
According to "Python in a Nutshell(2nd)", p. 523: connect: s.connect((host, port)) .... Blocks until the server accepts or rejects the connection attempt. However, my client program ends...
5
by: scorpionbilli | last post by:
Hi, The local mysql server is running on my Macbook. I can access it through the console client: $ mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL...
3
by: mp | last post by:
Code is at bottom. Basically, if I turn off socket blocking prior to connecting, I get a "Socket is not connected" error when I try to send data. However, if I do not turn off blocking, OR if I...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.