#6 using as normal socket

closed
nobody
None
5
2005-06-22
2005-04-17
Raul Elizondo
No

Hi,

Before i saw this today i used stunnel a while a go, so
i m not that experienced on ssl and i m trying to use
tsl for a simple socket connection, but i m getting an
error. I quikly downloaded a sample for socket link in
tcl and in changed socket by tls::socket but i keep
getting the same error "reading and writing both
disallowed for channel" while executing "tsl::import..."

+server.tcl on 192.168.0.10
package require tls
set s [tls::socket -server accept 12345]
tls::import $s -cipher DES-EDE3-CBC
proc accept {s a port} {
fileevent $s readable [list echo $s]
fconfigure $s -translation lf -buffering line
}
proc echo {s} {
global x
set l [gets $s]
if {[eof $s]} {
close $s
set x done
} else {
puts $s "Echoed: $l"
puts "Echoed to stdout: $l"
}
}
puts "Waiting..."
vwait forever

+client.tcl on 192.168.0.11
package require tls
set s [tls::socket 192.168.0.10 12345]
fconfigure $s -buffering line
puts $s "test test test"

----
I've been playing around with tcl::import option, using
a .pem and all other options, but not susses yet.

Any hint? (i know i m missing lot of stuff on
tls::import, so any reference would be apreciated)

Regards
-=Raul=-

Discussion

  • Raul Elizondo
    Raul Elizondo
    2005-04-17

    Logged In: YES
    user_id=845708

    got the samples, i downloaded the full source from where i
    found the simpleClient.tcl and the simpleServer.tcl.

     
  • Dan Razzell
    Dan Razzell
    2005-06-22

    Logged In: YES
    user_id=376568

    I think that stunnel is a very useful option if you simply require a SSL connection between hosts. The TLS package is for Tcl/Tk programmers who need a similar capability in that environment.

    Your problem seems to be a combination of programming discipline and Tcl socket programming. Try cleaning up your code, and try using plain sockets before converting to TLS sockets.

     
  • Dan Razzell
    Dan Razzell
    2005-06-22

    • status: open --> closed