473,788 Members | 2,811 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.getaddri nfo('localhost' , port,
socket.AF_INET, socket.SOCK_STR EAM)[0]
s = socket.socket(a f, socktype, proto)
s.settimeout(1. 0)
s.connect(('loc alhost', 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 1763
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.a r>
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
4826
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: " . mysql_error()); echo "Connected successfully"; mysql_close($link);
1
6543
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 need. Except when network issues, or firewalls drop packets silently. It'll sit and hang around forever, which grinds the scripts dependant upon it to a halt.
1
121535
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 alpha) so I deinstall mysql5-server and mysql5-client And then I install mysql41-server and mysql41-client on FreeBSD 5.3 by ports but now , mysql is not workable
7
17415
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 local or the remote endpoint from the client-side socket. The *really* strange thing is that Socket.LocalEndPoint is null. According to the doc, that's impossible: reading the LocalEndPoint
14
25272
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 tried a test, and I can't bind two sockets to the same port/ip but I can connect with one socket, and bind with another to the same ip/port. Thanks
0
1434
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 trying to reproduce a very small piece of nmap, since nmap has to get a port's banner in order to figure out the version. However, I haven't been entirely successful. *******************************************************
2
1608
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 immediately after the call to connect()--even though my server program does not call accept():
5
2636
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 connection id is 4 Server version: 5.0.45 MySQL Community Server (GPL)
3
8455
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 place a print statement anywhere before the send call, it works! WTF? I'd like to understand what's going on in the background here, if you know don't skimp on the details. Thanks
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10364
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10172
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.