Hi.,

Yes, once you make the socket noblocking, your current ssl API,s will
not work. that is why I asked you to write the asynchronous state
machine. Go thro the man pages for ssl accept, ssl read, ssl write for
non blocking cases. You need to handle special cases called want read
and write errors.

I will send a detailed email a little later.

Thanks
--Gayathri
On Monday, May 9, 2011, Harshvir Sidhu <hvssi...@gmail.com> wrote:
>
> Hi,
>     I used the following code to change the socket to non blocking, but its 
> still not successful, now its not even able to complete SSL_Accept. I am 
> changing the socket option for the accepted socket.
>
>          unsigned long iMode = 1;
>          int nReturn = ioctlsocket(sock, FIONBIO, &iMode);
>          if(nReturn != NO_ERROR)
>          {
>              printf(("ioctlsocket failed with error: %ld\n", nReturn));
>          }
>
>     Also i suspect, that if i change the socket to non blocking, then my 
> current read write code will not work. i mean the one in which i use FD_SET 
> and select to perform operations.
>
> Thanks.
>
> // Harshvir
>
>
>
>
> On Fri, May 6, 2011 at 10:33 PM, Gayathri Sundar <suraj...@gmail.com> wrote:
> Harsh.,
>
> If u have any specific doubts in writing this asynchronous state
> machine email me privately at suraj...@gmail.com.
> I am pretty much jobless right now and can spend some time on this.
>
> Thanks
> --Gayathri
>
>
>
>
>
> On Friday, May 6, 2011, Harshvir Sidhu <hvssi...@gmail.com> wrote:
>> Thanks, I will give this a try.
>> // Harshvir
>>
>> On Fri, May 6, 2011 at 6:44 PM, Eric S. Eberhard <fl...@vicsmba.com> wrote:
>> Change the sockets.  This is what I use:
>>
>> int setblock(fd, mode)
>> int fd;
>> int mode;                       /* True - blocking, False - non blocking */
>> {
>>         int flags;
>>         int prevmode;
>>
>>         flags = fcntl(fd, F_GETFL, 0);
>>         prevmode = !(flags & O_NDELAY);
>>         if (mode)
>>                 flags &= ~O_NDELAY;             /* turn blocking on */
>>         else
>>                 flags |= O_NDELAY;              /* turn blocking off */
>>         fcntl(fd, F_SETFL, flags);
>>
>>         return prevmode;
>> }
>>
>> Since it returns the existing mode you can use as such:
>>
>> prevmode = setblock(fd,0)                       /* turn of blocking */
>> /* do your thing */
>> (void)setblock(fd,prevmode);                    /* restore to original 
>> condition */
>>
>> At 04:15 PM 5/6/2011, you wrote:
>>
>> Thanks for the reply Gayathri.
>> Do you mean to changing the sockets to non blocking, or when i create bio 
>> for ssl to make that as non blocking?
>>
>> Thanks.
>>
>>
>> On Fri, May 6, 2011 at 6:03 PM, Gayathri Sundar 
>> <<mailto:suraj...@gmail.com>suraj...@gmail.com> wrote:
>> Harsh,
>>
>> Okay from what I can understand, if you make ur underlying fd non blocking 
>> then it would work fine. Blocking FDs, unless and until one client is 
>> finished with its processing the other client will not be able to 
>> communicate with the server as the previous fd is blocked. The server is 
>> waiting on the 1st client to finish. When you have 3 ports and 3 clients 
>> then ofcourse it will work.
>>
>> thanks
>> --Gayathri
>>
>>
>>
>> On Fri, May 6, 2011 at 5:50 PM, Harshvir Sidhu 
>> <<mailto:hvssi...@gmail.com>hvssi...@gmail.com> wrote:
>> Gayatri,
>> My server code is single threaded and i am using blocking sockets, i am 
>> using fd_set and select to wait for event on socket, and then performing 
>> operation based on the event that acts on a socket.
>> I have an array of sockets to listen. So if i start listening on 3 different 
>> ports and from my client machien, i try to connect on them at different 
>> ports then it works fine, but when i use 1 listen port then it dont work 
>> properly. What i mean to say by work properly is that the connection is 
>> established, but when i am waiting for select to return event, then it dont 
>> show any activity when i send data from client, only 1 of them works, 2 dont 
>> work.
>> In addition to that, when i use WireShark to see packets, then it shows that 
>> machine has received the packet from client. But server dont show that alert.
>> Thats why i think it could be some socket option which is affecting it.
>>
>> // Harshvir
>>
>>
>>
>> On Fri, May 6, 2011 at 5:37 PM, Gayathri Sundar 
>> <<mailto:suraj...@gmail.com>suraj...@gmail.com> wrote:
>> Harshvir,
>>
>> SO_REUSEADDR sock option has noting to do with ur problem, please go thro 
>> the socket ops man page to get a better understanding. First find out if ur 
>> server code is a blocking i/o or non blocking I/O..if former then 
>> connections will be handled sequentially..only after the 1st client is 
>> finished will the server be able to respond to the 2nd connect request. If 
>> non blocking then there should be no problem. Check the code if you see and 
>> O_NONBLOCK flag set in some fcntl call or check for FIONBIO flag.
>>
>> Thanks
>> --Gayathri
>>
>>
>>
>> On Fri, May 6, 2011 at 5:29 PM, Harshvir Sidhu 
>> <<mailto:hvssi...@gmail.com>hvssi...@gmail.com> wrote:
>> Well i think this link is for my question.
>> I have already done 1-5 from the Before you ask list.
>> Number 6, i dont know anyone who use openssl.
>> Number 7, it will take a lot of time to go through all the code, i was just 
>> trying to save some time. I thought user discussion forums are for this 
>> only. I apologize for my understanding.
>>
>
>
>
> ______________________________________________________________________
> OpenSSL Project                                 
> http://www.openssl.org <http://www.openssl.org/>
> User Support Mailing List                    openssl-users@openssl.org
> Automated List Manager                           majord...@openssl.org
>
>
>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to