[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question on optional connect data field
You need to call setsockopt to add the optional data to the connect block before doing the connect. The sequence is:
socket(AF_DECnet. SOCK_SEQPACKET, DNPROTO_NSP);
setsockopt(fd. DNPROTO_NSP, SO_CONDATA, &optdata, sizeof(optdata));
connect(...)
See dnetd and libdnet_daemon for example bits of code but that should be enough to get you going.
Patrick
________________ Reply Header ________________
Subject: Question on optional connect data field
Author: Rob Davies <robdavies@worldnet.att.net>
Date: Fri, 7 Jan 2000 05:37:18 +0000
Hi all,
I'm trying to establish a DECnet connection to a remote DECnet named object. I've been looking through the phoned code, and from that I assume I should be using something along the lines of:
out_fd = socket(AF_DECnet, SOCK_SEQPACKET, DNPROTO_NSP)
out_sockaddr.sdn_family = AF_DECnet;
out_sockaddr.sdn_flags = 0x00;
out_sockaddr.sdn_objnum = 0x00;
out_sockaddr.sdn_objnamel = obj_name_len; out_sockaddr.sdn_objname = obj_name;
out_sockaddr.sdn_add.a_len = 0x02;
out_sockaddr.sdn_add.a_addr = dest_addr;
connect(out_fd, &out_sockaddr, len_out_sockaddr)
OK, here comes the question:
I want to send up to 16 bytes of optional user data in the connect message.
I know that *somewhere* in the code is the capability to do it, as there's a structure defined in dn.h as:
struct optdata_dn {
unsigned short opt_status; /* Extended status return */ #define opt_sts opt_status
unsigned short opt_optl; /* Length of user data */
unsigned char opt_data[16]; /* User data */ };
So ... where does this fit in when I'm doing a 'connect()' ? ... or is there some other secret alternative to 'connect' ?
Also, at the other end of the connection, how do I retrieve the optional user data from the connect message ? I was planning on using select() and accept() and read(), but I'm not sure where the optional data would appear? ... maybe at the accept() stage ? How do I get at it?
Thanks in advance.
Rob. ----------------------------------------------------------------------------- To unsubscribe from this list, send a mail to majordomo@dreamtime.org containing the line "unsubscribe linux-decnet" -----------------------------------------------------------------------------
-----------------------------------------------------------------------------
To unsubscribe from this list, send a mail to majordomo@dreamtime.org
containing the line "unsubscribe linux-decnet"
-----------------------------------------------------------------------------