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

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


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  



With kind regards


More information about the User mailing list