Help! - Connect error under RH 6.1

Help! - Connect error under RH 6.1

Post by Binu K. Bab » Tue, 01 Feb 2000 04:00:00



I am quite new to Linux and programming. I have recently installed Red
Hat 6.1 in my system with kernel 2.2.12-20. The installation went off
soothly without any problems. Since I wanted to do some network
programming, I wrote a program which displays Time of day using port 13.
The compilation went off without a hitch. When the program was run, I
could create the socket. but when I try to connect to the socket, the
program terminates with a connect error saying that the connection was
refused. Can some one help me in finding out what went wrong. The
program I tried was the first program from Richard Stevens UNIX Network
Programming - Second edition.
 
 
 

Help! - Connect error under RH 6.1

Post by William R. Matt » Tue, 01 Feb 2000 04:00:00



Quote:>I am quite new to Linux and programming. I have recently installed Red
>Hat 6.1 in my system with kernel 2.2.12-20. The installation went off
>soothly without any problems. Since I wanted to do some network
>programming, I wrote a program which displays Time of day using port 13.
>The compilation went off without a hitch. When the program was run, I
>could create the socket. but when I try to connect to the socket, the
>program terminates with a connect error saying that the connection was
>refused. Can some one help me in finding out what went wrong. The
>program I tried was the first program from Richard Stevens UNIX Network
>Programming - Second edition.

It depends on if you have written the server, or the client. If you have
written the client and it is expecting a server there won't be one on a
typical (unmodified) Red Hat install. If you have written a server and
cannot connect to it (say via tcp - telnet) then check out your access
abilities /etc/hosts.allow and /etc/hosts.deny. You can also try killing
*your* server, uncommenting the standard service in /etc/inetd.conf and
then trying to access it that way. If it works :^) then you will probably
need to fix your code ......

Hope this helps .....

I can tell you this though, that the code in the Stevens book works well in
every example that I have tried.

Regards

Bill
--
William R. Mattil       | This Space is Available for Rent  

(972) 399-4106          |                                  

 
 
 

Help! - Connect error under RH 6.1

Post by TJ Thurst » Fri, 04 Feb 2000 04:00:00



[snip]

Quote:> So my guess is that when I tried to run time of day client with port 13,
> my connection was refused 13.

You probably got a "connection refused" error because the DayTime service
line in inetd.conf is commented out (ie the DayTime service is not being
implimented).  Have a look at /etc/inetd.conf - my guess is that the line
for the DayTime service (which listens on port 13), is commented out.  To
turn the service on you'll need to uncomment the line, and send inetd the
HUP signal.

Quote:> When I wrote the server program with port 13, I couldn't bind maybe
> because port 13 was a reserved port and other programs are not supposed
> to use it.

Only processes with an effective user ID of 0 are allowed to bind to
"reserved ports", which are all ports below 1024 (see the ip(4) man page
for details).  You're code is almost certainly not running with an
effective user ID of 0, so it is not allowed to bind to ports < 1024.

Hope this helps,

Tom

 
 
 

1. [: too many arguments error in RH 6.1, please help

I get the following error message when I login as a non-root user
[: too many arguments

Some things work fine, and others don't.  For instance, I can type startx to
get xwindows running, but netscape and sound don't work. They do work when I
log in as root.
Can you offer any suggestions?
Jason

2. Autofs problem

3. RH 6.1 -- plz help with errors in starting httpd (Apache)

4. Ensoniq Sound card

5. RH 6.1 Can't connect ISP

6. gvc 14" monitor setup?

7. Connected but no Internet (RH 6.1)

8. Suexec and ScriptAlias/ScriptAliasMatch

9. RH 6.1 and Mandrake 6.1 Freeze on Install

10. problems with starting X window on RH 6.1,description of error

11. ssh 1.2.27 make error on RH 6.1

12. RH 6.1, 3C905C Checksum Error?

13. tar - unrecoverable error on RH 6.1