12 Mayıs 2012 Cumartesi


Dim clientsayisi As Integer
Dim flag As Boolean

Private Sub client_DataArrival(ByVal bytesTotal As Long)
Dim data As String
Dim ayir() As String
Dim gönderenisim As String
Dim mesaj As String
client.GetData data
ayir() = Split(data, "zxfçjdgy")


If ayir(0) = "pm" Then


End If

If ayir(0) = "allmesaj" Then
msgbx.Text = ">" + ayir(1) + "" + "   " + ayir(2) + msgbx.Text
msgbx.Text = vbCrLf + msgbx.Text
End If

End Sub

Private Sub Command3_Click()
client.Connect Text2.Text, 11111
End Sub

Private Sub Command4_Click()
If pm.Text = "" Then
'herkese gönder
client.SendData "allmesaj" & "zxfçjdgy" & isim.Text & "zxfçjdgy" & sendmsg.Text
End If

End Sub

Private Sub Form_Load()
client.RemoteHost = client.LocalIP
client.RemotePort = "11111"
flag = True
cliensayisi = 0
server(0).LocalPort = "11111"
server(0).Listen
msgbx.Text = vbCrLf + msgbx.Text
End Sub

Private Sub msgbx_Change()

End Sub

Private Sub sendmsg_Click()
If client.State = sckConnected Then
If flag = True Then
client.SendData "isim" & "zxfçjdgy" & isim.Text
flag = False
End If
End If

End Sub

Private Sub server_ConnectionRequest(Index As Integer, ByVal requestID As Long)
server(Index).Close
server(Index).Accept requestID

clientsayisi = clientsayisi + 1

Load server(clientsayisi)
server(clientsayisi).LocalPort = "11111"
server(clientsayisi).Listen

End Sub

Private Sub server_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Dim data As String

server(Index).GetData data
Dim ayir() As String
ayir() = Split(data, "zxfçjdgy")

If ayir(0) = "isim" Then
user.AddItem Index & "," & ayir(1)
'/////////////

'/////////////
ElseIf ayir(0) = "allmesaj" Then
For i = 0 To clientsayisi - 1
If server(i).State = sckConnected Then
server(i).SendData data
End If
Next i

ElseIf ayir(0) = "pm" Then
For i = 0 To clientsayisi - 1
If server(i).State = sckConnected Then
server(i).SendData data
End If
Next i

End If
End Sub

Private Sub server_Error(Index As Integer, 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)
MsgBox "Server Error"
End Sub

Hiç yorum yok:

Yorum Gönder