[Gambas-user] Timeout in class socket (gb.net)

Hans Lehmann hans at gambas-buch.de
Wed Sep 9 20:01:00 CEST 2020


Hello,

i am still experimenting with the classes Socket and ServerSocket. I
have the problem how to use the property Socket.Timeout in a meaningful
way. For example I want to connect to a time server on port 37 to get
the current timestamp. But there are time servers which are not always
reachable. Now the question: How do I intercept the timeout if I use for
example the following source code:

    Public Sub btnConnect_Click()
       
        TCP_Socket.Timeout = 1000

    '-- TCP-Verbindung initialisieren (Host und Port)
        TCP_Socket.Host = cmbHost.Text   
        If IsInteger(txbPort.Text) Then TCP_Socket.Port = Val(txbPort.Text)

     '-- Verbindung zum Server herstellen  
        TCP_Socket.Connect()

    ...

    End


With kind regards

Hans


More information about the User mailing list