socket connect problem on RH6.0

socket connect problem on RH6.0

Post by Joshua Grauma » Fri, 30 Jul 1999 04:00:00



The following code was working fine on my RedHat 5.1 box, but I recently

upgraded to RedHat 6.0 and now the connect call I gives an EACCES
error. perror() prints "connecting stream socket: Permission denied".
From the connect() man page:

       EACCES  The  user  tried to connect to a broadcast address
       without having the socket broadcast flag  enabled.

I thought that the second line of code should take care of that...
Thanks
for the help. Please also reply to my email.

Joshua Grauman

  val=1;
  setsockopt(sock1,SOL_SOCKET,SO_BROADCAST,&val,0);
  setsockopt(sock1,SOL_SOCKET,SO_REUSEADDR,&val,0);
  if (sock1 < 0)
  {
    perror("opening stream socket");
    exit(1);
  }
  server1.sin_family = AF_INET;
  hp1 = gethostbyname("192.168.1.255");
  if (hp1 == 0)
  {
    fprintf(stderr, "192.168.1.255: unknown host");
    exit(2);
  }
  bcopy(hp1->h_addr, &server1.sin_addr, hp1->h_length);
  server1.sin_port = htons(10276);
  if (connect(sock1, &server1, sizeof(server1)) < 0)
  {
   perror("connecting stream socket");
    exit(1);
  }
  if (write(sock1, string1, sizeof(string1)) < 0)
    perror("writing on stream socket");
  close(sock1);

 
 
 

socket connect problem on RH6.0

Post by Joshua Grauma » Fri, 30 Jul 1999 04:00:00


I figured out my problem... The last parameter of setsockopt
is supposed to be 4. I don't know why it worked on RedHat 5.1,
maybe something changed... Thanks.

Joshua Grauman

> The following code was working fine on my RedHat 5.1 box, but I recently
> upgraded to RedHat 6.0 and now the connect call I gives an EACCES
> error. perror() prints "connecting stream socket: Permission denied".
> From the connect() man page:

>        EACCES  The  user  tried to connect to a broadcast address
>        without having the socket broadcast flag  enabled.

> I thought that the second line of code should take care of that...
> Thanks for the help. Please also reply to my email.

> Joshua Grauman

>   val=1;
>   setsockopt(sock1,SOL_SOCKET,SO_BROADCAST,&val,0);
>   setsockopt(sock1,SOL_SOCKET,SO_REUSEADDR,&val,0);
>   if (sock1 < 0)
>   {
>     perror("opening stream socket");
>     exit(1);
>   }
>   server1.sin_family = AF_INET;
>   hp1 = gethostbyname("192.168.1.255");
>   if (hp1 == 0)
>   {
>     fprintf(stderr, "192.168.1.255: unknown host");
>     exit(2);
>   }
>   bcopy(hp1->h_addr, &server1.sin_addr, hp1->h_length);
>   server1.sin_port = htons(10276);
>   if (connect(sock1, &server1, sizeof(server1)) < 0)
>   {
>    perror("connecting stream socket");
>     exit(1);
>   }
>   if (write(sock1, string1, sizeof(string1)) < 0)
>     perror("writing on stream socket");
>   close(sock1);


 
 
 

1. Failed to connect to term socket '/home/sjw/.term/socket

Term problem: The subject says it... when I run

tupload /usr/bin/term /usr/temp

As the HOWTO suggests on both my single user Linux system as well as
the network Suns over the phone line at my internet site I get (again)

Term: Failed to connect to term socket '/home/sjw/.term/socket'

I used the standard install from AP sets for my linus system and
the term-2.2.4 package install (./configure --user; make install)
on the Sun end.

both ends have .term directories with

darkstar:~> ls -l .term
total 3
srwxr-xr-x   1 sjw      users           0 Jan 28 20:08 socket=
-rwxr-xr-x   1 sjw      users        2730 May 29  1993 termrc*

So I'd guess there's a socket there. What obviousness am I missing?

Thanks for any help
Steve

(P.S. Based on the new HOWTO, I also installed the /usr/src/term-2.2.4
as shared under root - trying to do the 'chgrp term <term_client>;
chmod g+s <term_client>' stuff guessing what <term-client> files were
intended - and run termtest. All I got was

bash# termtest &
[1] 898
bash# tupload .xinitrc /tmp
Term: Failed to connect to term socket '/usr/local/lib/term/tmp/private/socket'
bash#
)

2. HELP, recursively traversing a hierarchical directory structure

3. Making Linux server sockets connect with Borland C++ builder Client Sockets?

4. silent freeze with redhat 5

5. Failed to connect to term socket '/home2/irvine/.term/socket'

6. Can't run any application in rlogin mode.

7. Problem connecting Linux (RH6.0) to ISP (prodiy.net)

8. notatla used to revoke remaining of those offending

9. HELP: Internet connect Problem (RH6.1)

10. Using eXceed to connect ot RH6.0 problems

11. Problem connecting Win98 and Linux RH6.2 using TCP/IP

12. Term problem: cannot connect to socket!

13. IRIX networking problem - Socket won't connect