SCTP Discussions

Text archives Help


Re: [SCTP-Discussion] ext_getsockopt and ext_setsockopt problems


Chronological Thread 
  • From: Thomas Dreibholz <dreibh AT exp-math.uni-essen.de>
  • To: "Oon Heok Kee" <oonheokkee78 AT hotmail.com>
  • Cc: discussion AT sctp.de
  • Subject: Re: [SCTP-Discussion] ext_getsockopt and ext_setsockopt problems
  • Date: Mon Oct 21 15:57:01 2002
  • List-id: SCTP Discussions <discussion.sctp.de>
  • Organization: University of Essen, Institute for Experimental Mathematics

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am Montag, 21. Oktober 2002 15:47 schrieben Sie:
> Thomas,
>
> Thank you very much for the reply. So you mean in this case I can only
> call ext_getsockopt() and ext_setsockopt() after ext_connect() or
> ext_accept() (not taking into account SCTP_INITMSG)? Just to confirm, is
> this the way:
>
>
>
> int i_ret_handle, i_handle, i_opt, i_opt_size;
>
> i_handle = ext_socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP);
> i_ret_handle = ext_connect(i_handle, (struct sockaddr *) &sock,
> sizeof(sock);
> i_opt = 0x8000;
> ext_setsockopt(i_ret_handle, SOL_SOCKET, SO_RCVBUF, (void*) &i_opt,
> sizeof(i_opt);
> i_opt = 0;
> i_opt_size = sizeof(i_opt);
> ext_getsockopt(i_ret_handle, SOL_SOCKET, SO_RCVBUF, (void*) &i_opt,
> &i_opt_size);
>
>
>
> I tried the above, but I got an error "Socket operation on non-socket",
> because i_ret_handle == 0, on both occasion of calling ext_getsockopt() and
> ext_setsockopt().

Please read the manual page for connect() (man 2 connect). ext_connect() will
connect the socket speficied by i_handle. It only returns whether or not this
has been successful. (Only ext_accept() returns a new socket FD.)

Try this:

i_handle = ext_socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP);
result = ext_connect(i_handle, (struct sockaddr *) &sock, sizeof(sock));
if(result == 0) {
i_opt = 0x8000;
ext_setsockopt(i_handle, SOL_SOCKET, SO_RCVBUF, (void*)
&i_opt,sizeof(i_opt);
i_opt = 0;
i_opt_size = sizeof(i_opt);
ext_getsockopt(i_handle, SOL_SOCKET, SO_RCVBUF, (void*) &i_opt,
&i_opt_size);
}


Best regards
- --
=======================================================================
Dipl.-Inform. Thomas Dreibholz

University of Essen, Room ES210
Inst. for Experimental Mathematics Ellernstraße 29
Computer Networking Technology Group D-45326 Essen/Germany
- -----------------------------------------------------------------------
E-Mail:
dreibh AT exp-math.uni-essen.de
Homepage: http://www.exp-math.uni-essen.de/~dreibh
=======================================================================
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9tAaN32BbsHYPLWURAopmAKCv0SQm6TIDvVS7ZceZ+VqwKj+suwCdHUv3
ANP99sPoZnOBm+5Cr+sqOYw=
=MzoI
-----END PGP SIGNATURE-----




Archive powered by MHonArc 2.6.19+.

Top of page