evt arkadaşlar kendime bole winsockdan saglam bir chat yapmayı duşundum ve başladım herşey tmm ancak kucuk kucuk ufak ufak sorunlar var bunun icin yardım istiyecem ilkcncelikle projemden başlayalım
Foruma
1 listbox name=list1
5 tane text box
1. textbox gonderme icin name=yolla
2. textbox ip icin name=sa
3.textbox nick icin name=lakap
4. texbox port icin name=port
5.textbox yerelport icin bağlantı isteği name=yerelport
1 adet winsock nesnesi bilmeyenler icin ctrl+t microsoft winsock control ismi aynı kalsın
4 buton
1.buton bağlan name=bağlan
2.buton bağlantı kes name=bağlantıkes
3.buton bağlantı bekle name=bağlantıbekle
4.buton yazı gonder name=gonder
1 adet label
1.label durum icin name=durum
sora kodları yapıştırın:
Kod:
Private Sub Form_Load() If Winsock1.State = 0 Then Durum.Caption = "Kapalı!" If Winsock1.State = 8 Then Durum.Caption = "Kapatılıyor!" If Winsock1.State = 7 Then Durum.Caption = "Bağlantı Var!" If Winsock1.State = 6 Then Durum.Caption = "Bağlanılıyor!" If Winsock1.State = 3 Then Durum.Caption = "Bağlantı Beklemede!" If Winsock1.State = 9 Then Durum.Caption = "Hata!" If Winsock1.State = 2 Then Durum.Caption = "Server Kuruldu Bağlantı Bekleniyor Dinlemede!" If Winsock1.State = 1 Then Durum.Caption = "Acık!" If Winsock1.State = 7 Then List1.Enabled = True Yolla.Enabled = True Gonder.Enabled = True End If End Sub Private Sub Bağlan_Click() If Winsock1.State sckClosed Then Winsock1.Close Winsock1.Close Winsock1.RemoteHost = sa.Text Winsock1.RemotePort = Port.Text Winsock1.Connect If Winsock1.State = 0 Then Durum.Caption = "Kapalı!" If Winsock1.State = 8 Then Durum.Caption = "Kapatılıyor!" If Winsock1.State = 7 Then Durum.Caption = "Bağlantı Var!" If Winsock1.State = 6 Then Durum.Caption = "Bağlanılıyor!" If Winsock1.State = 3 Then Durum.Caption = "Bağlantı Beklemede!" If Winsock1.State = 9 Then Durum.Caption = "Hata!" If Winsock1.State = 2 Then Durum.Caption = "Server Kuruldu Bağlantı Bekleniyor Dinlemede!" If Winsock1.State = 1 Then Durum.Caption = "Acık!" If Winsock1.State = 7 Then List1.Enabled = True Yolla.Enabled = True Gonder.Enabled = True End If End Sub Private Sub BağlantıBekle_Click() If Winsock1.State sckClosed Then Winsock1.Close Winsock1.Close Winsock1.LocalPort = YerelPort.Text Winsock1.Listen If Winsock1.State = 0 Then Durum.Caption = "Kapalı!" If Winsock1.State = 8 Then Durum.Caption = "Kapatılıyor!" If Winsock1.State = 7 Then Durum.Caption = "Bağlantı Var!" If Winsock1.State = 6 Then Durum.Caption = "Bağlanılıyor!" If Winsock1.State = 3 Then Durum.Caption = "Bağlantı Beklemede!" If Winsock1.State = 9 Then Durum.Caption = "Hata!" If Winsock1.State = 2 Then Durum.Caption = "Server Kuruldu Bağlantı Bekleniyor Dinlemede!" If Winsock1.State = 1 Then Durum.Caption = "Acık!" If Winsock1.State = 7 Then List1.Enabled = True Yolla.Enabled = True Gonder.Enabled = True End If End Sub Private Sub BağlantıKes_Click() Winsock1.Close If Winsock1.State = 0 Then Durum.Caption = "Kapalı!" If Winsock1.State = 8 Then Durum.Caption = "Kapatılıyor!" If Winsock1.State = 7 Then Durum.Caption = "Bağlantı Var!" If Winsock1.State = 6 Then Durum.Caption = "Bağlanılıyor!" If Winsock1.State = 3 Then Durum.Caption = "Bağlantı Beklemede!" If Winsock1.State = 9 Then Durum.Caption = "Hata!" If Winsock1.State = 2 Then Durum.Caption = "Server Kuruldu Bağlantı Bekleniyor Dinlemede!" If Winsock1.State = 1 Then Durum.Caption = "Acık!" If Winsock1.State = 7 Then List1.Enabled = True Yolla.Enabled = True Gonder.Enabled = True End If End Sub Private Sub Winsock1_Close() Durum.Caption = "Bağlantı Kesildi!" List1.Enabled = False Yolla.Enabled = False Gonder.Enabled = False If Winsock1.State = 0 Then Durum.Caption = "Kapalı!" If Winsock1.State = 8 Then Durum.Caption = "Kapatılıyor!" If Winsock1.State = 7 Then Durum.Caption = "Bağlantı Var!" If Winsock1.State = 6 Then Durum.Caption = "Bağlanılıyor!" If Winsock1.State = 3 Then Durum.Caption = "Bağlantı Beklemede!" If Winsock1.State = 9 Then Durum.Caption = "Hata!" If Winsock1.State = 2 Then Durum.Caption = "Server Kuruldu Bağlantı Bekleniyor Dinlemede!" If Winsock1.State = 1 Then Durum.Caption = "Acık!" If Winsock1.State = 7 Then List1.Enabled = True Yolla.Enabled = True Gonder.Enabled = True End If End Sub Private Sub Winsock1_Connect() Durum.Caption = "Bağlantı Var!" List1.Enabled = True Yolla.Enabled = True Gonder.Enabled = True If Winsock1.State = 0 Then Durum.Caption = "Kapalı!" If Winsock1.State = 8 Then Durum.Caption = "Kapatılıyor!" If Winsock1.State = 7 Then Durum.Caption = "Bağlantı Var!" If Winsock1.State = 6 Then Durum.Caption = "Bağlanılıyor!" If Winsock1.State = 3 Then Durum.Caption = "Bağlantı Beklemede!" If Winsock1.State = 9 Then Durum.Caption = "Hata!" If Winsock1.State = 2 Then Durum.Caption = "Server Kuruldu Bağlantı Bekleniyor Dinlemede!" If Winsock1.State = 1 Then Durum.Caption = "Acık!" End Sub Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long) If Winsock1.State sckClosed Then Winsock1.Close Winsock1.Accept requestID Durum.Caption = "Bağlantı İsteği Kabul Edildi!" If Winsock1.State = 0 Then Durum.Caption = "Kapalı!" If Winsock1.State = 8 Then Durum.Caption = "Kapatılıyor!" If Winsock1.State = 7 Then Durum.Caption = "Bağlantı Var!" If Winsock1.State = 6 Then Durum.Caption = "Bağlanılıyor!" If Winsock1.State = 3 Then Durum.Caption = "Bağlantı Beklemede!" If Winsock1.State = 9 Then Durum.Caption = "Hata!" If Winsock1.State = 2 Then Durum.Caption = "Server Kuruldu Bağlantı Bekleniyor Dinlemede!" If Winsock1.State = 1 Then Durum.Caption = "Acık!" If Winsock1.State = 7 Then List1.Enabled = True Yolla.Enabled = True Gonder.Enabled = True End If End Sub Private Sub Gonder_Click() Winsock1.SendData Lakap.Text + nick1.Caption + Yolla.Text List1.AddItem Lakap.Text + nick1.Caption + Yolla.Text Yolla.Text = "" End Sub Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long) Dim mesaj As String Winsock1.GetData mesaj List1.AddItem mesaj If Winsock1.State = 0 Then Durum.Caption = "Kapalı!" If Winsock1.State = 8 Then Durum.Caption = "Kapatılıyor!" If Winsock1.State = 7 Then Durum.Caption = "Bağlantı Var!" If Winsock1.State = 6 Then Durum.Caption = "Bağlanılıyor!" If Winsock1.State = 3 Then Durum.Caption = "Bağlantı Beklemede!" If Winsock1.State = 9 Then Durum.Caption = "Hata!" If Winsock1.State = 2 Then Durum.Caption = "Server Kuruldu Bağlantı Bekleniyor Dinlemede!" If Winsock1.State = 1 Then Durum.Caption = "Acık!" If Winsock1.State = 7 Then List1.Enabled = True Yolla.Enabled = True Gonder.Enabled = True End If End Sub Private Sub Yolla_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Winsock1.SendData Lakap.Text + nick1.Caption + Yolla.Text List1.AddItem Lakap.Text + nick1.Caption + Yolla.Text Yolla.Text = "" End If End Sub
Şimdik geldi sorulara sorunlara isteklere hatalara
1.sorum şu ben bunu list ile yaptım acaba textboxtan satır satır kayması mumkunmu
2.sorum bağlantı yapıldığı sure veyatta gun saat labele nasıl yazdırılır
3.sorum bunu sadece ağ uzerinden diğilde msn gibi veyatta başka bi şekilde internet uzerinden olmazmı
hatalar yok
yapmak istediğim şu ip port ve lakap kutucugu boş oldugunda msgbox ile hata demesi ve gorevi iptal etmesi bole bişey yaptım ama bu seferde winsock ile bağlantı kuramıyor
birde winsockla sadece yazı değilde başka şeylerde gonderilebilirmi resim mğzik dosya klasor gibi cartcurt felan filan bunlar sadece bir soru bazıları cıkıpta sen kime emir veriyosun kardeşim demesin lutfen yardımlarınızı bekliorm
__________________
Winsock Chat Bir kac Hata İstek Ve Soru
Programlama0 Mesaj
●26 Görüntüleme
- ReadBull.net
- Programlama ve Yazılım
- Programlama
- Winsock Chat Bir kac Hata İstek Ve Soru