[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: select/accept DECnet connection question ...



Yep ... setting the 'master' socket to blocking immediately before the
accept() and then setting it back immediately afterwards appears to
work.

I get a valid file descriptor returned from accept() now ... thanks!


OK ... new problem discovered now that I get a valid file descriptor
returned.

I'm using SO_CONDATA to pass some validation data ... 2 bytes right now,
but it could be up to 16 bytes. In the client connection request, I do:

   struct optdata_dn   optdata;

   sockfd = socket(AF_DECnet, SOCK_SEQPACKET, DNPROTO_NSP);
   CLEAR(optdata);                      <--- memset() to '0'
   optdata.opt_data[0] = 2;
   optdata.opt_data[1] = 0;
   optdata.opt_optl = 2;
   optdata.opt_sts = 0;
   status = setsockopt(sockfd,DNPROTO_NSP,SO_CONDATA,
                     &optdata,sizeof(optdata));
   
This returns '0', so it *appears* to have worked ...


On the server end, after I do the accept() (see previous code ... ) I
do:

   struct optdata_dn    optdata;
   int                  len;


( file_desc is the returned value from the accept() )

   status = getsockopt(file_desc,DNPROTO_NSP,SO_CONDATA,&optdata,&len);


   This returns:

(gdb) p status
$1 = -1
(gdb) p errno
$2 = 22

(gdb) p strerror(22)
$3 = 0x40114471 "Invalid argument"


... Am I doing something wrong here? Do I have to do this on the master
file descriptor before I do the accept() ?


Thanks

Rob.