Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Chat Semplice - Client.frm

Client.frm

Caricato da:
Scarica il programma completo

  1. Private Sub Command1_Click()
  2. If Len(Text4.Text) > 0 Then
  3.   Winsock1.SendData Text4.Text
  4.     Text3.Text = Text3.Text & "<Client>" & Text4.Text & vbCrLf
  5.       Text3.SelStart = Len(Text3.Text)
  6.     Text4.Text = vbNullString
  7.   Label5.Caption = "Invio di " & LenB(Text4.Text) & "Bytes"
  8. End If
  9. End Sub
  10.  
  11. Private Sub Command2_Click()
  12. Static Stat As Boolean
  13. If Stat = False Then
  14.   If Len(Text1.Text) > 0 And Len(Text2.Text) > 0 Then
  15.     Winsock1.Connect Text1, Val(Text2.Text)
  16.       Command2.Caption = "Disconnetti"
  17.         Stat = True
  18.         Label5.Caption = "Connessione in corso"
  19.       Else
  20.     MsgBox "Dati mancanti", vbExclamation
  21.   End If
  22. Else
  23.   Winsock1.Close
  24.     Stat = False
  25.     Label5.Caption = "Chisura in corso"
  26.   Command2.Caption = Connetti
  27. End If
  28. End Sub
  29.  
  30. Private Sub Winsock1_Close()
  31. Winsock1.Close
  32. Label5.Caption = "Disconnesso"
  33. End Sub
  34.  
  35. Private Sub Winsock1_Connect()
  36. Label5.Caption = "Connesso"
  37. End Sub
  38.  
  39. Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
  40. Dim Data As String
  41. Winsock1.GetData Data
  42. Label5.Caption = "In arrivo " & bytesTotal & "Bytes"
  43. Text3.Text = Text3.Text & "<Remoto>" & Data & vbCrLf
  44. Text3.SelStart = Len(Text3.Text)
  45. End Sub
  46.  
  47. Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
  48. Winsock1.Close
  49. MsgBox "Errore TCP " & Number & vbCrLf & Description
  50. Label5.Caption = "Errore TCP " & Number
  51. End Sub
  52.  
  53. Private Sub Winsock1_SendComplete()
  54. Label5.Caption = "Dati inviati"
  55. End Sub