rewrite function for ssl compatibility

This is a discussion on rewrite function for ssl compatibility within the C++ Programming forums, part of the General Programming Boards category; OK I have the following function Code: int canreadwrite(SOCKET rsocket, SOCKET wsocket) { fd_set rset, wset; struct timeval tval; tval.tv_sec=0; ...

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    71

    rewrite function for ssl compatibility

    OK I have the following function

    Code:
    int canreadwrite(SOCKET rsocket, SOCKET wsocket) {
    	fd_set rset, wset;
    	struct timeval tval;
       tval.tv_sec=0;
       tval.tv_usec=10;
       FD_ZERO(&rset);
       FD_ZERO(&wset);
       FD_SET(rsocket,&rset);
    	FD_SET(wsocket,&wset);
       select( max( (int)rsocket, (int)wsocket )+1, &rset, &wset, 0, &tval );
       if ( FD_ISSET( rsocket, &rset) && FD_ISSET( wsocket, &wset ) ) {
       	return 0;
       } else {
       	return 1;
       }
    }
    But I want to change this function so I can give it a SSL socket.

    I use the open SSL lib.
    I tried this

    Code:
    int canreadwrite(SSL *rsocket, SSL *wsocket) {
    but than I get an error C2440: '=' : cannot convert from 'SSL *' to 'SOCKET'
    to this lines

    Code:
       FD_SET(rsocket,&rset);
    	FD_SET(wsocket,&wset);

  2. #2
    Registered User
    Join Date
    May 2006
    Posts
    35
    i don;'t know much about sockets, but it's probably because you aren't dereferecing wsocket and rsocket. try *rsocket and *wsocket in the FD_SET() function call

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Post your games here...
    By Hammer in forum Game Programming
    Replies: 132
    Last Post: 02-28-2013, 09:29 AM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 12:45 PM
  3. dllimport function not allowed
    By steve1_rm in forum C++ Programming
    Replies: 5
    Last Post: 03-11-2008, 04:33 AM
  4. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 01:03 PM
  5. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21