🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sun
Article #6753

Sun3 - Sun4 communication problem

#6753
From: David Goldstein
Date: Mon, 28 Jan 1991 18:29
98 lines
4066 bytes
I've been having difficulty debugging some code that compiles and runs on
both Sun 3's and 4's, but only works correctly on the Sun 4.  The purpose
of the routine is to set up sockets using internet & TCP, and to send
messages to the internet address number that has previously been looked
up.  On the Sun 3's, the following message is generated: (during the
write)

Sending fact to processor named arrisun3
in lookup_dest, looking for |arrisun3|, at |arrisun3|
trying to send tcp
: write_socket: write failed: Bad address   <*********

and the code relating to the error being:

/* Make a socket and listen for connections */
int make_server_socket(serv_port)
int serv_port;              /*  server port  */
{
extern struct hostent *gethostbyname();
struct hostent *rhp;
int s, on =0;
struct sockaddr_in raddress;

    s = socket(AF_INET, SOCK_STREAM, 0);
    if (s < 0) give_error("socket in make_server_socket");

    /* look up address of the destination machine */
    if ((rhp = gethostbyname(my_host_name)) == NULL)
        give_error("gethostbyname make_server_socket");
    bzero((char *)&raddress, sizeof(raddress));
    bcopy(rhp->h_addr,(char *)&raddress.sin_addr,rhp->h_length);
    raddress.sin_family =  AF_INET;
/*    raddress.sin_addr.s_addr =  INADDR_ANY; */
    raddress.sin_port = serv_port;         /* server port */
    if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0)
        give_error("setsocketopt in make_server_socket");

    if (bind(s, (struct sockaddr *) &raddress, sizeof(struct sockaddr_in)))
        give_error("bind_socket");
   if (listen(s, 10) < 0)
        give_error("listen make_server_socket");
   return(s);
}


b4accepting(i,count)
int i,count;
{
  sock[i] = make_server_socket(ws[i].adrs);
  if (dont_block(sock[i]) < 0) perror("Creating non-blocking pilot socket");
  fprintf(stderr,"%s: B4listening, listening for %s socket %d at adrs %d.\n",
          my_host_name,ws[i].name,sock[i],ws[i].adrs);
}


accepting(i)
int i;
{
int g;
   g = accept(sock[i],0,0);  /* modifies a copied socket */
   if (g > 0) {
      sock[i] = g;
      fprintf(stderr,"%s: Connected at socket # %d: %s\n",
              progname,g,my_host_name);
      if (dont_block(sock[i])< 0) perror("Resetting non-blocking attributes");
      connected[i] = TRUE;
      who_head = insert(ws[i].name,who_head,sock[i],TCP);
      printf("connected  to proc %d= TRUE, %s uses socket %d\n",
              i,ws[i].name,sock[i]);
      }
   else if ( g < 0 && errno != EWOULDBLOCK) {
           fprintf(stderr,"%s: Error connecting %s\n",progname,my_host_name);
           perror("accepting connection");
           } else {
             printf("in never-never land?\n"); sleep(1); 
/* Terminate(1);  */
             }
}

Sorry about the bad job of cutting and pasting; I should have loaded up an
editted file instead (?).   These routines show how the address is looked
up, and I don't know the differences between Sun3 and Sun4 lookups.  As I
said, none of the initialization causes any errors, and my diagnostics
print:

Initializing sockets
1processing argument arrisun3, #1
processing method  SOCKET, arg #2
processor arrisun3 using sockets
tcparg=|arrisun3|
2Hostname is arrisun1 of 1 workstations
Will start in 10 seconds....hurry up other machines!
Establishing connection

to verify that the system is indeed coming up on the Sun 3.

thanks!  I will post replies if Sun3 - Sun4 communication is of general
interest!
Technical Details
Message-ID: <1505@brchh104.bnr.ca>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brtph3!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brtph3!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request
From: goldstn@evax.uta.edu (David Goldstein)
Newsgroups: comp.sys.sun
Subject: Sun3 - Sun4 communication problem
Keywords: Networks
Message-ID: <1505@brchh104.bnr.ca>
Date: 28 Jan 91 18:29:21 GMT
Sender: news@brchh104.bnr.ca
Organization: Sun-Spots
Lines: 98
Approved: Sun-Spots@rice.edu
X-Sun-Spots-Digest: Volume 10, Issue 32, message 4
X-Note: Submissions: sun-spots@rice.edu, Admin: sun-spots-request@rice.edu