Re: openssl from tcl



I have finally gotten back to the TLS code and there is definitely
some kind of a race condition problem where often you would get lots
of empty data in the beginning of the request. I have spent some time
figuring a way out of it and the only way I could deal with it is to
retry "gets sock" after each empty data until I get some good data. I
don't like that solution at all because it might last indefinitely, so
I had to set up a counter and stop after
some number of [gets sock]. The counter has not exceeded 500 so far
but you never know.

So, basically, I cannot use the following code:
while {[gets $sock data] >= 0} {...} -- which is the code used most of
the time in examples on how to get the request data from the client.

I instead ended up using something like this:

set counter 0
while {![eof $sock]} {
incr counter
if {$counter >= 1000} {break}
gets $sock data
if {$data == ""} {
continue
}
....
process the data
....

}

I hope this will get fixed, because timing out is not a good solution
(not happen yet to me with the time out count set to 1000, but in some
cases it probably will happen). I want to read and process every
request correctly.
Of course, there is probably a better solution. That's where people
like Alex Ferrieux often come to the rescue. ;)
.



Relevant Pages

  • C (I think) to Perl Conversion
    ... I have a sample script which accomplishes the task I need ... printf("Socket creation failed"); ... if (connect(sock, (const struct sockaddr *)&rcon_server,sizeof( ... printf("packet size: %d, request id:%d, command:%d\n", ...
    (comp.lang.perl.misc)
  • help with sockets please --second attempt
    ... I posted a request for help a few days ago but didn't get any answers. ... a socket is opened and data is sent and received back. ... the checkbutton is unselected, the sock is closed. ... global broadcast sock ...
    (comp.lang.tcl)