자유게시판입니다.
Private Sub tcp_DataArrival(Index As Integer, ByVal bytesTotal As Long)
'<=========================================================================================================>
'
' | N G D MESSINGER SERVER SUB ROOTINE |
'
' =========================================================
'
' 소스의 무단복제를 금지합니다.
'
'<--------------------------------------------------------------------------------------------------------->
Dim datas As String
tcp(Index).GetData datas
loglist.AddItem "Accept Command ->" & "SKID : " & Index & " -> " & datas
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
la.Caption = la.Caption + 1
Select Case Mid(datas, 1, 3)
Case "log"
loglist.AddItem "Unindentify User " & Index & " Command -> " & datas & " (로그인요청)"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
Dim id As String
Dim pass As String
Dim skid As Integer
Dim tempi As Integer
Dim tempok As Boolean
Dim idok As Boolean
tempi = 5
For j = 5 To Len(datas)
If Mid(datas, j, 1) <> ":" Then
tempi = tempi + 1
Else
id = Mid(datas, 5, tempi - 5)
pass = Mid(datas, tempi + 1, Len(datas))
skid = Index
loglist.AddItem "Unindentify User " & Index & " Login Command -> ID : " & id & " Pass : " & pass & " SK : " & skid
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
For mm = 0 To onlist.ListCount - 1
If id = onlist.List(mm) Then
If tcp(Index).State = 7 Then
tcp(Index).SendData "log:da"
DoEvents
loglist.AddItem "Send Command ->" & "SKID : " & p_user(j, 4) & " -> " & "log:da"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
loglist.AddItem "다중접속 ID : " & id & " - 로그인 거부"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
Exit Sub
End If
End If
Next
For i = 1 To p_cnt
If id = p_user(i, 1) Then
If pass = p_user(i, 2) Then
If tcp(Index).State = 7 Then
tcp(Index).SendData "log:ok:" & p_user(i, 8) & ":"
DoEvents
loglist.AddItem "Send Command ->" & "SKID : " & p_user(j, 4) & " -> " & "log:ok"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
tempok = True
p_user(i, 4) = skid
p_user(i, 7) = "04"
p_user(i, 6) = Date & " - " & Time
End If
End If
End If
Next
If tempok = True Then
loglist.AddItem "SKID " & skid & " User " & id & " is Logon now." & Date & " - " & Time
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
log_user = log_user + 1
sb.Panels.Item(2).Text = "Login User : " & onlist.ListCount
onlist.AddItem id
For k = 0 To offlist.ListCount - 1
If offlist.List(k) = id Then
offlist.RemoveItem (k)
End If
Next
Else
If tcp(Index).State = 7 Then
loglist.AddItem "SKID " & skid & " User " & id & " is Not Regist User. 허가거부"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
tcp(Index).SendData "log:no"
DoEvents
loglist.AddItem "Send Command ->" & "SKID : " & p_user(j, 4) & " -> " & "log:no"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
End If
End If
End If
Next
Case "nid"
Dim iddd As String
Dim idoks As Boolean
iddd = Mid(datas, 5, Len(datas) - 4)
idoks = True
For i = 1 To p_cnt
If iddd = p_user(i, 1) Then
idoks = False
End If
Next
If idoks = True Then
If tcp(Index).State = 7 Then
tcp(Index).SendData "nid:ok"
DoEvents
loglist.AddItem "Send Command ->" & "SKID : " & p_user(Index, 4) & " -> " & "nid:ok"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
End If
ElseIf idoks = False Then
If tcp(Index).State = 7 Then
tcp(Index).SendData "nid:no"
DoEvents
loglist.AddItem "Send Command ->" & "SKID : " & p_user(Index, 4) & " -> " & "nid:no"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
End If
End If
Case "new"
Dim new_id As String
Dim new_name As String
Dim new_sex As String
Dim new_pass As String
Dim new_email As String
Dim new_birth As String
Dim new_job As String
Dim new_age As String
Dim new_text As String
Dim new_count As Integer
new_count = 1
new_text = Mid(datas, 5, Len(datas) - 4)
For i = 1 To Len(new_text)
If Mid(new_text, i, 1) = ":" Then
new_count = new_count + 1
End If
Select Case new_count
Case 1
new_id = new_id & Mid(new_text, i, 1)
Case 2
new_name = new_name & Mid(new_text, i, 1)
Case 3
new_sex = new_sex & Mid(new_text, i, 1)
Case 4
new_pass = new_pass & Mid(new_text, i, 1)
Case 5
new_email = new_email & Mid(new_text, i, 1)
Case 6
new_birth = new_birth & Mid(new_text, i, 1)
Case 7
new_job = new_job & Mid(new_text, i, 1)
Case 8
new_age = new_age & Mid(new_text, i, 1)
End Select
Next
new_name = Mid(new_name, 2, Len(new_name) - 1)
new_sex = Mid(new_sex, 2, Len(new_sex) - 1)
new_pass = Mid(new_pass, 2, Len(new_pass) - 1)
new_email = Mid(new_email, 2, Len(new_email) - 1)
new_birth = Mid(new_birth, 2, Len(new_birth) - 1)
new_job = Mid(new_job, 2, Len(new_job) - 1)
new_age = Mid(new_age, 2, Len(new_age) - 1)
p_cnt = p_cnt + 1
Open fp & "data\user.cot" For Output As #1
Print #1, p_cnt - 2
Close #1
Dim old_cnt As Integer
old_cnt = Mid(sb.Panels.Item(3), Len(sb.Panels.Item(3)), 1)
odl_cnt = old_cnt + 1
sb.Panels.Item(3).Text = "Join User : " & p_cnt - 2
p_user(p_cnt - 2, 1) = new_id
p_user(p_cnt - 2, 3) = new_name
p_user(p_cnt - 2, 9) = new_sex
p_user(p_cnt - 2, 2) = new_pass
p_user(p_cnt - 2, 5) = new_email
p_user(p_cnt - 2, 11) = new_birth
p_user(p_cnt - 2, 12) = new_job
p_user(p_cnt - 2, 13) = new_age
offlist.AddItem new_id
Open fp & "data\user.pdt" For Output As #1
For i = 1 To p_cnt - 2
Write #1, p_user(i, 1)
Write #1, p_user(i, 2)
Write #1, p_user(i, 3)
Write #1, p_user(i, 5)
Write #1, p_user(i, 8)
Write #1, p_user(i, 9)
Write #1, p_user(i, 11)
Write #1, p_user(i, 12)
Write #1, p_user(i, 13)
Write #1, p_user(i, 14)
Next
Close #1
If tcp(Index).State = 7 Then
loglist.AddItem "Creat User -> " & new_id & " at " & Data & " - " & Time
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
tcp(Index).SendData "new:ok"
DoEvents
loglist.AddItem "SKID (" & Index & ") -> new:ok"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
End If
Case "msg"
Dim msg_count As Integer
Dim msg_text As String
Dim msg_id As String
Dim msg_data As Variant
Dim msg_eidok As Boolean
Dim msg_eidnt As Boolean
Dim msg_sendid
msg_eidok = True
msg_eidnt = True
msg_text = Mid(datas, 5, Len(datas) - 4)
For i = 1 To p_cnt
If p_user(i, 4) = Index Then
msg_sendid = p_user(i, 1)
End If
Next
msg_count = 1
For i = 1 To Len(msg_text)
If msg_count <> 2 Then
If Mid(msg_text, i, 1) = ":" Then
msg_count = msg_count + 1
End If
Select Case msg_count
Case 1
msg_id = msg_id & Mid(msg_text, i, 1)
Case 2
msg_data = msg_data & Mid(msg_text, i, 1)
End Select
Else
msg_data = msg_data & Mid(msg_text, i, 1)
End If
Next
For i = 1 To p_cnt
If p_user(i, 1) = msg_id Then
msg_eidok = False
For j = 0 To onlist.ListCount - 1
If onlist.List(j) = msg_id Then
msg_eidnt = False
End If
Next
End If
Next
msg_data = Mid(msg_data, 2, Len(msg_data) - 1)
' 에러처리루틴 (로그온사용자, 비등록사용자 구분 에러처리)
If msg_eidok = True Then
msg_eidnt = False
End If
If msg_eidnt = True Then
loglist.AddItem "MSG 로그온사용자가 아님 (쪽지전송실패)" & msg_id & " Send From (" & msg_sendid & ")"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
If tcp(Index).State = 7 Then
tcp(Index).SendData "msg:eo"
DoEvents
End If
loglist.AddItem "SKID (" & Index & ") -> msg:eo"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
ElseIf msg_eidok = True Then
loglist.AddItem "MSG 등록사용자가 아님 (쪽지전송실패)" & msg_id & " Send From (" & msg_sendid & ")"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
If tcp(Index).State = 7 Then
tcp(Index).SendData "msg:en"
DoEvents
End If
loglist.AddItem "SKID (" & Index & ") -> msg:en"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
Else
For i = 1 To p_cnt
If p_user(i, 1) = msg_id Then
If tcp(p_user(i, 4)).State = 7 Then
tcp(p_user(i, 4)).SendData "msg:ok:" & msg_sendid & ":" & msg_data
DoEvents
loglist.AddItem "Send Command -> " & "msg:ok:" & msg_sendid & ":" & msg_data
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
End If
End If
Next
End If
Case "fdi"
Dim fdi_id As String
Dim fdi_senddata As String
Dim fdi_result As Boolean
fdi_result = False
fdi_id = Mid(datas, 5, Len(datas) - 4)
For i = 1 To p_cnt
If fdi_id = p_user(i, 1) Then
If tcp(Index).State = 7 Then
fdi_senddata = "fdf:01:" & p_user(i, 1) & ":" & p_user(i, 3) & ":" & p_user(i, 13) & ":" & p_user(i, 9) & ":" & p_user(i, 12) & ":"
tcp(Index).SendData fdi_senddata
DoEvents
loglist.AddItem "Send Command -> To " & Index & " -> " & fdi_senddata
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
fdi_result = True
End If
End If
Next
If fdi_result = False Then
If tcp(Index).State = 7 Then
fdi_senddata = "fdf:00"
DoEvents
tcp(Index).SendData fdi_senddata
loglist.AddItem "Send Command -> To " & Index & " -> " & fdi_senddata
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
End If
End If
Case "fdn"
Dim fdn_name As String
Dim fdn_senddata As String
Dim fdn_a As String
Dim fdn_c As Integer
Dim fdn_result As Boolean
fdn_result = False
fdn_name = Mid(datas, 5, Len(datas) - 4)
fdn_c = 0
For i = 1 To p_cnt
If fdn_name = p_user(i, 3) Then
fdn_a = fdn_a & p_user(i, 1) & ":" & p_user(i, 3) & ":" & p_user(i, 13) & ":" & p_user(i, 9) & ":" & p_user(i, 12) & ":"
fdn_c = fdn_c + 1
fdn_result = True
End If
Next
If fdn_c < 10 Then
fdn_senddata = "fdf:0" & fdn_c & ":" & fdn_a
Else
fdn_senddata = "fdf:" & fdn_c & ":" & fdn_a
End If
If fdn_result = False Then '사람이 없을떄 처리
If tcp(Index).State = 7 Then
fdi_senddata = "fdf:00"
tcp(Index).SendData fdn_senddata
======== 중략 ===========
저게 메신저 서버 프로그램의 극 일부라죠;
나름대로 로그인, 쪽지전송등 중요역할을 맡고있는 부분이지만...ㅡㅡ;; 전혀 비효율적인 코딩으로 망해버렸다는...;;
핫핫! 다시 만들고있습니다만..ㅡㅡ 언제 완성될까나;;
'<=========================================================================================================>
'
' | N G D MESSINGER SERVER SUB ROOTINE |
'
' =========================================================
'
' 소스의 무단복제를 금지합니다.
'
'<--------------------------------------------------------------------------------------------------------->
Dim datas As String
tcp(Index).GetData datas
loglist.AddItem "Accept Command ->" & "SKID : " & Index & " -> " & datas
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
la.Caption = la.Caption + 1
Select Case Mid(datas, 1, 3)
Case "log"
loglist.AddItem "Unindentify User " & Index & " Command -> " & datas & " (로그인요청)"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
Dim id As String
Dim pass As String
Dim skid As Integer
Dim tempi As Integer
Dim tempok As Boolean
Dim idok As Boolean
tempi = 5
For j = 5 To Len(datas)
If Mid(datas, j, 1) <> ":" Then
tempi = tempi + 1
Else
id = Mid(datas, 5, tempi - 5)
pass = Mid(datas, tempi + 1, Len(datas))
skid = Index
loglist.AddItem "Unindentify User " & Index & " Login Command -> ID : " & id & " Pass : " & pass & " SK : " & skid
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
For mm = 0 To onlist.ListCount - 1
If id = onlist.List(mm) Then
If tcp(Index).State = 7 Then
tcp(Index).SendData "log:da"
DoEvents
loglist.AddItem "Send Command ->" & "SKID : " & p_user(j, 4) & " -> " & "log:da"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
loglist.AddItem "다중접속 ID : " & id & " - 로그인 거부"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
Exit Sub
End If
End If
Next
For i = 1 To p_cnt
If id = p_user(i, 1) Then
If pass = p_user(i, 2) Then
If tcp(Index).State = 7 Then
tcp(Index).SendData "log:ok:" & p_user(i, 8) & ":"
DoEvents
loglist.AddItem "Send Command ->" & "SKID : " & p_user(j, 4) & " -> " & "log:ok"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
tempok = True
p_user(i, 4) = skid
p_user(i, 7) = "04"
p_user(i, 6) = Date & " - " & Time
End If
End If
End If
Next
If tempok = True Then
loglist.AddItem "SKID " & skid & " User " & id & " is Logon now." & Date & " - " & Time
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
log_user = log_user + 1
sb.Panels.Item(2).Text = "Login User : " & onlist.ListCount
onlist.AddItem id
For k = 0 To offlist.ListCount - 1
If offlist.List(k) = id Then
offlist.RemoveItem (k)
End If
Next
Else
If tcp(Index).State = 7 Then
loglist.AddItem "SKID " & skid & " User " & id & " is Not Regist User. 허가거부"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
tcp(Index).SendData "log:no"
DoEvents
loglist.AddItem "Send Command ->" & "SKID : " & p_user(j, 4) & " -> " & "log:no"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
End If
End If
End If
Next
Case "nid"
Dim iddd As String
Dim idoks As Boolean
iddd = Mid(datas, 5, Len(datas) - 4)
idoks = True
For i = 1 To p_cnt
If iddd = p_user(i, 1) Then
idoks = False
End If
Next
If idoks = True Then
If tcp(Index).State = 7 Then
tcp(Index).SendData "nid:ok"
DoEvents
loglist.AddItem "Send Command ->" & "SKID : " & p_user(Index, 4) & " -> " & "nid:ok"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
End If
ElseIf idoks = False Then
If tcp(Index).State = 7 Then
tcp(Index).SendData "nid:no"
DoEvents
loglist.AddItem "Send Command ->" & "SKID : " & p_user(Index, 4) & " -> " & "nid:no"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
End If
End If
Case "new"
Dim new_id As String
Dim new_name As String
Dim new_sex As String
Dim new_pass As String
Dim new_email As String
Dim new_birth As String
Dim new_job As String
Dim new_age As String
Dim new_text As String
Dim new_count As Integer
new_count = 1
new_text = Mid(datas, 5, Len(datas) - 4)
For i = 1 To Len(new_text)
If Mid(new_text, i, 1) = ":" Then
new_count = new_count + 1
End If
Select Case new_count
Case 1
new_id = new_id & Mid(new_text, i, 1)
Case 2
new_name = new_name & Mid(new_text, i, 1)
Case 3
new_sex = new_sex & Mid(new_text, i, 1)
Case 4
new_pass = new_pass & Mid(new_text, i, 1)
Case 5
new_email = new_email & Mid(new_text, i, 1)
Case 6
new_birth = new_birth & Mid(new_text, i, 1)
Case 7
new_job = new_job & Mid(new_text, i, 1)
Case 8
new_age = new_age & Mid(new_text, i, 1)
End Select
Next
new_name = Mid(new_name, 2, Len(new_name) - 1)
new_sex = Mid(new_sex, 2, Len(new_sex) - 1)
new_pass = Mid(new_pass, 2, Len(new_pass) - 1)
new_email = Mid(new_email, 2, Len(new_email) - 1)
new_birth = Mid(new_birth, 2, Len(new_birth) - 1)
new_job = Mid(new_job, 2, Len(new_job) - 1)
new_age = Mid(new_age, 2, Len(new_age) - 1)
p_cnt = p_cnt + 1
Open fp & "data\user.cot" For Output As #1
Print #1, p_cnt - 2
Close #1
Dim old_cnt As Integer
old_cnt = Mid(sb.Panels.Item(3), Len(sb.Panels.Item(3)), 1)
odl_cnt = old_cnt + 1
sb.Panels.Item(3).Text = "Join User : " & p_cnt - 2
p_user(p_cnt - 2, 1) = new_id
p_user(p_cnt - 2, 3) = new_name
p_user(p_cnt - 2, 9) = new_sex
p_user(p_cnt - 2, 2) = new_pass
p_user(p_cnt - 2, 5) = new_email
p_user(p_cnt - 2, 11) = new_birth
p_user(p_cnt - 2, 12) = new_job
p_user(p_cnt - 2, 13) = new_age
offlist.AddItem new_id
Open fp & "data\user.pdt" For Output As #1
For i = 1 To p_cnt - 2
Write #1, p_user(i, 1)
Write #1, p_user(i, 2)
Write #1, p_user(i, 3)
Write #1, p_user(i, 5)
Write #1, p_user(i, 8)
Write #1, p_user(i, 9)
Write #1, p_user(i, 11)
Write #1, p_user(i, 12)
Write #1, p_user(i, 13)
Write #1, p_user(i, 14)
Next
Close #1
If tcp(Index).State = 7 Then
loglist.AddItem "Creat User -> " & new_id & " at " & Data & " - " & Time
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
tcp(Index).SendData "new:ok"
DoEvents
loglist.AddItem "SKID (" & Index & ") -> new:ok"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
End If
Case "msg"
Dim msg_count As Integer
Dim msg_text As String
Dim msg_id As String
Dim msg_data As Variant
Dim msg_eidok As Boolean
Dim msg_eidnt As Boolean
Dim msg_sendid
msg_eidok = True
msg_eidnt = True
msg_text = Mid(datas, 5, Len(datas) - 4)
For i = 1 To p_cnt
If p_user(i, 4) = Index Then
msg_sendid = p_user(i, 1)
End If
Next
msg_count = 1
For i = 1 To Len(msg_text)
If msg_count <> 2 Then
If Mid(msg_text, i, 1) = ":" Then
msg_count = msg_count + 1
End If
Select Case msg_count
Case 1
msg_id = msg_id & Mid(msg_text, i, 1)
Case 2
msg_data = msg_data & Mid(msg_text, i, 1)
End Select
Else
msg_data = msg_data & Mid(msg_text, i, 1)
End If
Next
For i = 1 To p_cnt
If p_user(i, 1) = msg_id Then
msg_eidok = False
For j = 0 To onlist.ListCount - 1
If onlist.List(j) = msg_id Then
msg_eidnt = False
End If
Next
End If
Next
msg_data = Mid(msg_data, 2, Len(msg_data) - 1)
' 에러처리루틴 (로그온사용자, 비등록사용자 구분 에러처리)
If msg_eidok = True Then
msg_eidnt = False
End If
If msg_eidnt = True Then
loglist.AddItem "MSG 로그온사용자가 아님 (쪽지전송실패)" & msg_id & " Send From (" & msg_sendid & ")"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
If tcp(Index).State = 7 Then
tcp(Index).SendData "msg:eo"
DoEvents
End If
loglist.AddItem "SKID (" & Index & ") -> msg:eo"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
ElseIf msg_eidok = True Then
loglist.AddItem "MSG 등록사용자가 아님 (쪽지전송실패)" & msg_id & " Send From (" & msg_sendid & ")"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
If tcp(Index).State = 7 Then
tcp(Index).SendData "msg:en"
DoEvents
End If
loglist.AddItem "SKID (" & Index & ") -> msg:en"
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
Else
For i = 1 To p_cnt
If p_user(i, 1) = msg_id Then
If tcp(p_user(i, 4)).State = 7 Then
tcp(p_user(i, 4)).SendData "msg:ok:" & msg_sendid & ":" & msg_data
DoEvents
loglist.AddItem "Send Command -> " & "msg:ok:" & msg_sendid & ":" & msg_data
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
End If
End If
Next
End If
Case "fdi"
Dim fdi_id As String
Dim fdi_senddata As String
Dim fdi_result As Boolean
fdi_result = False
fdi_id = Mid(datas, 5, Len(datas) - 4)
For i = 1 To p_cnt
If fdi_id = p_user(i, 1) Then
If tcp(Index).State = 7 Then
fdi_senddata = "fdf:01:" & p_user(i, 1) & ":" & p_user(i, 3) & ":" & p_user(i, 13) & ":" & p_user(i, 9) & ":" & p_user(i, 12) & ":"
tcp(Index).SendData fdi_senddata
DoEvents
loglist.AddItem "Send Command -> To " & Index & " -> " & fdi_senddata
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
fdi_result = True
End If
End If
Next
If fdi_result = False Then
If tcp(Index).State = 7 Then
fdi_senddata = "fdf:00"
DoEvents
tcp(Index).SendData fdi_senddata
loglist.AddItem "Send Command -> To " & Index & " -> " & fdi_senddata
loglist.Selected(loglist.ListCount - 1) = True
loglist.Selected(loglist.ListCount - 1) = False
ls.Caption = ls.Caption + 1
End If
End If
Case "fdn"
Dim fdn_name As String
Dim fdn_senddata As String
Dim fdn_a As String
Dim fdn_c As Integer
Dim fdn_result As Boolean
fdn_result = False
fdn_name = Mid(datas, 5, Len(datas) - 4)
fdn_c = 0
For i = 1 To p_cnt
If fdn_name = p_user(i, 3) Then
fdn_a = fdn_a & p_user(i, 1) & ":" & p_user(i, 3) & ":" & p_user(i, 13) & ":" & p_user(i, 9) & ":" & p_user(i, 12) & ":"
fdn_c = fdn_c + 1
fdn_result = True
End If
Next
If fdn_c < 10 Then
fdn_senddata = "fdf:0" & fdn_c & ":" & fdn_a
Else
fdn_senddata = "fdf:" & fdn_c & ":" & fdn_a
End If
If fdn_result = False Then '사람이 없을떄 처리
If tcp(Index).State = 7 Then
fdi_senddata = "fdf:00"
tcp(Index).SendData fdn_senddata
======== 중략 ===========
저게 메신저 서버 프로그램의 극 일부라죠;
나름대로 로그인, 쪽지전송등 중요역할을 맡고있는 부분이지만...ㅡㅡ;; 전혀 비효율적인 코딩으로 망해버렸다는...;;
핫핫! 다시 만들고있습니다만..ㅡㅡ 언제 완성될까나;;