Programa 3 adet buton 3 adet textbox 2 adet label ve 1 adet winsock yerleştirin
Kod:
Private Sub Command1_Click() On Error GoTo ht Dim RM Dim RP As Long RM = Text1.Text RP = 8080 sck.Connect RM, RP Command2.Enabled = False Exit Sub ht: lbl.Caption = "Hatalı bağlantı isteği..." End Sub Private Sub Command2_Click() On Error GoTo ht sck.Listen Command1.Enabled = False Exit Sub ht: lbl.Caption = "Bağlantı bekleniyor..." End Sub Private Sub Command3_Click() Command1.Enabled = True Command2.Enabled = True sck.Close End Sub Private Sub Form_Load() sck.LocalPort = 8080 sck.RemotePort = 8080 End Sub Private Sub sck_Close() lbl.Caption = "Bekleniyor..." Command3.Enabled = False Command2.Enabled = True Command1.Enabled = True End Sub Private Sub sck_Connect() lbl.Caption = "Bağlantı kuruldu..." Command3.Enabled = True Command2.Enabled = False Command1.Enabled = False End Sub Private Sub sck_ConnectionRequest(ByVal requestID As Long) If sck.State sckClosed Then sck.Close sck.Accept requestID lbl.Caption = "Bağlantı kabul edildi..." End Sub Private Sub sck_DataArrival(ByVal bytesTotal As Long) Dim GelenVeri As String sck.GetData GelenVeri List1.AddItem GelenVeri, 0 lbl.Caption = "Veri alındı..." End Sub Private Sub sck_SendComplete() lbl.Caption = "Veri yollandı..." End Sub Private Sub sck_SendProgress(ByVal bytesSent As Long, ByVal bytesRemaining As Long) lbl.Caption = "Gonderiliyor..." End Sub Private Sub Text2_KeyUp(KeyCode As Integer, Shift As Integer) On Error GoTo ht If KeyCode = 13 Then sck.SendData Text2.Text List1.AddItem Text2, 0 Text2 = "" Text2.SetFocus lbl.Caption = "Veri yollandı..." End If Exit Sub ht: lbl.Caption = "Veri ulaştırılamadı..." End Sub
__________________
WinSock ile chat (duzgun)
Programlama0 Mesaj
●28 Görüntüleme
- ReadBull.net
- Programlama ve Yazılım
- Programlama
- WinSock ile chat (duzgun)