LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-02-2004, 07:20 AM   #1
event
LQ Newbie
 
Registered: Aug 2004
Location: Riga Latvia
Distribution: gentoo
Posts: 1

Rep: Reputation: 0
socket problem


hello. I have some strange problem with socket connection.
I cannot make connection to localhost (127.0.0.1). Every time I have "connection refused". But i can connect to 22 port where sshd is running. I've tested it under Java and python. In python i have code:

Code:
from socket import socket
s = socket()
s1 = socket()
s.bind(('127.0.0.1', 10)) #used various ports
s1.connect(('127.0.0.1', 10))
error comes in 5th line.
Please note that i have no problems with sshd.
I use Gentoo Linux with 2.6.7 kernel (gentoo-dev-kernel).

I thought that problem is because of lack xinetd. But starting the deamon did not make me happy. Using of tcpd brought same results.
 
Old 08-02-2004, 08:25 AM   #2
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
You can only connect to a port if a process is actually listening to it, unless you're connecting to listen to it yourself.

Ports below 1024 are privilaged; you need root permissions in order to start listening to them, so you won't normally be able to listen on those ports anyway (this is why inetd starts running as root).

Also, you won't be able to connect to a port at all if a firewall is blocking your access to it.

Hope that's of some help,

— Robert J. Lee
 
Old 08-03-2004, 01:23 AM   #3
metasophix
LQ Newbie
 
Registered: Aug 2004
Location: usa
Distribution: red hat 7.0
Posts: 1

Rep: Reputation: 0
No idea about python. Sorry! But try from both sides. ie listen to socket on both m/cs one at a time. Try many times. Hope u'll get it.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Socket problem maevious Programming 2 11-26-2005 03:21 PM
cannot read data at server socket, though client socket sends it jacques83 Linux - Networking 0 11-15-2005 01:58 PM
Unable to connect to UNIX socket /tmp/.esd/socket error while using grip dr_zayus69 Linux - Software 4 08-23-2005 07:28 PM
Socket Problem Agent007 Linux - Networking 2 03-30-2004 03:53 PM
socket programming problem bgraur Programming 2 03-09-2003 09:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:44 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration