Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-01
01:47 • Ticket [219023ffff] Need nonblocking-while-creating sockets status still Clo... artifact: 5633cdc651 user: dgp
2000-10-26
08:33 • Closed ticket [219023ffff]. artifact: 74bb6ac762 user: welch
01:09 • New ticket [219023ffff]. artifact: a27c33ab7d user: nobody

Need nonblocking-while-creating sockets

Closed / Fixed219023ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:09:34
OriginalBugID: 4000 RFE
Version: 8.0.5
SubmitDate: '2000-01-10'
LastModified: '2000-01-10'
Severity: LOW
Status: Released
Submitter: techsupp
ChangedBy: hobbs
OS: Windows 95
FixedDate: '2000-01-10'
FixedInVersion: 8.2
ClosedDate: '2000-10-25'


Name:
Kerem HADIMLI

Extensions:
Pure Tcl 8.0.5 with no extensions

DesiredBehavior:
Any way to create sockets that are like -async switch (socket creation/connection doesn't block), but understand whether if the socket can connect or not?
Because I have to use blocking-while-connecting sockets (which are BAD), to understand if the socket can connect or not.

thanks,
Kerem 'Waster_' HADIMLI



Note from the newsgroup:

It IS possible to check the connection status of an asynchronous
socket:

     set sock [socket -async $host $port]
     fileevent $sock readable "getConnectState $sock"
     fileevent $sock writable "getConnectState $sock"

     proc getConnectState {sock} {
         fileevent $sock readable ""
         fileevent $sock writable ""

         set connectState [fconfigure $sock -error]
         if {[string compare $connectState ""] == 0} {
             puts "connected to server"
         } else {
             close $sock
             puts "connection failed"
         }
     }

This solution works well on UNIX.  On Windows it works with Tcl 8.2 or
higher, because the fileevent command was not implemented properly in
earlier versions of Tcl under Windows.  You should upgrade to Tcl 8.2.3
(or 8.3b1).

--
Csaba Nemethi   http://www.nemethi.de   mailto:[email protected]
 
-- 01/10/2000 hobbs
welch Closed ticket [219023ffff]. [History diff]2000-10-26 08:33:10
dgp Ticket [219023ffff]: 3 changes [History diff]2001-04-01 01:47:33
Log in (anonymous is fine) to add a comment.