'EKLENECEKLER
'Bir baglanti butonu
'Bir baglantikes butonu
'Bes tane text ac
'Bir tane label
'Bir winsock(ctrl+t tuslari yardimiyla secebilirsiniz)
'Bir tane timer [SIZE=2]Private Sub baglan_click()
Select Case winsock1.state
Case "0":
With winsock1
.remotehost = text1.Text
.remoteport = text2.Text
.Connect
Case "7"
MsgBox "Baglanti var" & vbcrlt & winsock1.remotehostIP & ":" & winsock1.remoteport, vbInformation, "hata"
End Select
End Sub
Private Sub baglantikes_click()
Select Case winsock1.state 'winsock un durumu
Case 0:
Case 7:
Dim cevap
cevap = MsgBox(winsock1.remotehostIP & ":" & winsock1.remoteport & "baglantiyi kesmek istediginizden emin misiniz?", vbInformation + vbYesNo, "baglanti kes")
If cevap = vbYes Then
winsock1.Close
End If
End Select
End Sub
Private Sub text3_keypress(keyascii As Integer)
If winsock1.state = 7 Then
If keyascii = 13 Then
winsock1.senddata text3.Text
text4.Text = text4.Text & "gonderilen" & text3 & vbCrLf
text3.Text = "" 'text i temizlemek icin ekliyoruz
End If
End If
End Sub
Private Sub text4_change()
text4.SelStart = Len(text4.Text)
End Sub
Private Sub timer1_timer()
Select Case winsock1.state
Case 0: label1.Caption = "kapali"
Case 1: label1.Caption = "acik"
Case 7: label1.Caption = "bagli"
Case 9: label1.Caption = "hata"
winsock1.Close 'hata oldugu zaman tekrar hazir duruma gelmesi icin
Case 8: label1.Caption = "baglanti kesildi"
winsock1.Close
End Select
End Sub
private sub winsock1_data arrival((ByVal bytesTotal As Long)
Dim gelen As String
winsock1.GetData gelen
text4.Text = text4.Text & "gelen:" & gelen & vbCrLf
text5.text = text5.text + bytes total/1000 ' gelen veriyi kb a cevirir
End Sub
Private Sub form_load()
text5.Text = "0" 'sifirlamazsak hata verecektir
End Sub[/SIZE]