Sign in to follow this  
Followers 0
JavaScript_Freek

TCP Chat "user has joined"

5 posts in this topic

How would you go along by adding that. I have tried and nothing.

Client.au3

#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)

Global Const $PORT = 31758
Global $list, $sock
Global $userlist[17][2]  ; [ index ][ username, ctrl id ]

TCPStartUp()

$gui = GUICreate("Login", 260, 100)
GUICtrlCreateLabel("Server IP", 10, 10, 60, 20)
GUICtrlCreateLabel("Username", 10, 40, 60, 20)
$ipctrl = GUICtrlCreateEdit(@IPADDRESS1, 80, 10, 170, 20, $ES_READONLY)
$userctrl = GUICtrlCreateInput("", 80, 40, 170, 20)
$login = GUICtrlCreateButton("Login", 170, 70, 80, 20, $BS_DEFPUSHBUTTON)

GUICtrlSetOnEvent($login, "_Login")
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

GUISetState()
$loop = True

While $loop
   Sleep(20)
WEnd

$gui = GUICreate("Urban Chat - User ("& $user & ")", 460, 230)
$list = GUICtrlCreateListView("         Users       ", 350, 10, 100, 210)
$edit = GUICtrlCreateEdit("Welcome to Urban Chat. "& $user & " Follow the rules!" & @CRLF & @CRLF , 10, 70, 330, 150, $ES_READONLY + $WS_VSCROLL + $ES_AUTOVSCROLL)
$input = GUICtrlCreateInput("", 10, 10, 330, 20)
$send = GUICtrlCreateButton("Send", 10, 40, 80, 20, $BS_DEFPUSHBUTTON)
$pm = GUICtrlCreateButton("PM", 100, 40, 80, 20)

GUICtrlSetOnEvent($send, "_Send")
GUICtrlSetOnEvent($pm, "_PM")
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

GUICtrlSetState($input, $GUI_FOCUS)
GUISetState()

_ReduceMemory()

While 1
   Sleep(0)
   $recv = TCPRecv($sock, 2048)
   If @error Then mError("Connection lost.", 1)
   If not $recv Then ContinueLoop
   ; parse the command(s)
   $recv = StringSplit($recv, Chr(1))
   For $i = 1 to $recv[0]
      $temp = StringSplit($recv[$i], Chr(2))
      Switch $temp[1]
         Case "rejected"
            mError("Connection rejected.", 1)
         Case "kick"
            mError("Connection kicked.", 1)
         Case "accepted"
            If $USER = "admin" Then
               $kick = GUICtrlCreateButton("Kick", 190, 40, 80, 20)
               GUICtrlSetOnEvent($kick, "_Kick")
            EndIf
         Case "adduser"
            _AddUser($temp[2])
         Case "deluser"
            _DelUser($temp[2])
         Case "exit"
            mError("Server has closed.", 1)
         Case Else
            If $recv[$i] Then GUICtrlSetData($edit, $recv[$i] & @CRLF, 1)
      EndSwitch
   Next
   _ReduceMemory()
WEnd


Func _Login()
   $loop = False
   Global Const $IP = GUICtrlRead($ipctrl)
   Global Const $USER = GUICtrlRead($userctrl)
   GUIDelete($gui)
   If $USER = "admin" Then
      Local $pass = InputBox("Enter Password:", "Please enter the server password below.", "", "")
      If @error Then Exit
      $sock = TCPConnect($IP, $PORT)
      If $sock = -1 Then mError("Internet needs to be turned on.", 1)
   Else
      $sock = TCPConnect($IP, $PORT)
      If $sock = -1 Then mError("Internet needs to be turned on.", 1)
      TCPSend($sock, $USER)
   EndIf
EndFunc

Func _Send()
   If not GUICtrlRead($input) Then Return 0
   TCPSend($sock, StringReplace(StringReplace(GUICtrlRead($input), Chr(1), ""), Chr(2), ""))
   GUICtrlSetData($input, "")
   Return 1
EndFunc

Func _PM()
   If not GUICtrlRead($input) Then Return 0
   Local $user = GUICtrlRead($list), $data = StringReplace(StringReplace(GUICtrlRead($input), Chr(1), ""), Chr(2), "")
   If not $user Then Return 0
   $user = GUICtrlRead($user)
   TCPSend($sock, Chr(1) & "PM" & Chr(2) & $user & Chr(2) & $data)
   GUICtrlSetData($input, "")
   GUICtrlSetData($edit, "PM sent to: " & $user & "" & @CRLF & "" & $data & "" & @CRLF, 1)
   Return 1
EndFunc

Func _Kick()
   Local $user = GUICtrlRead($list)
   If not $user Then Return 0
   $user = GUICtrlRead($user)
   TCPSend($sock, Chr(1) & "kick" & Chr(2) & $user)
   GUICtrlSetData($edit, "<** Kick: " & $user & " **>" & @CRLF, 1)
   Return 1
EndFunc

Func _AddUser( $user )
   If $user = "admin" and not $userlist[16][0] Then
      $userlist[16][0] = $user
      $userlist[16][1] = GUICtrlCreateListViewItem($user, $list)
      Return 1
   EndIf
   For $i = 0 to 15
      If not $userlist[$i][0] Then
         $userlist[$i][0] = $user
         $userlist[$i][1] = GUICtrlCreateListViewItem($user, $list)
         Return 1
      EndIf
   Next
   Return 0
EndFunc

Func _DelUser( $user )
   For $i = 0 to 16
      If $userlist[$i][0] = $user Then
         $userlist[$i][0] = ""
         GUICtrlDelete($userlist[$i][1])
         $userlist[$i][1] = 0
         Return 1
      EndIf
   Next
   Return 0
EndFunc

Func _ReduceMemory()
   DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", -1)
EndFunc

Func mError( $sText, $iFatal = 0, $sTitle = "Error", $iOpt = 0 )
   Local $ret = MsgBox(48 + 4096 + 262144 + $iOpt, $sTitle, $sText)
   If $iFatal Then Exit
   Return $ret
EndFunc

Func _RC4( $sData, $sKey )   ; based on code by Valik
   Local $l[256], $i, $t, $x, $y, $s = ""
   Local $iLen = StringLen($sKey)
   For $c = 0 to 255
      $l[$c] = $c
   Next
   For $c = 0 to 255
      $i = Mod(Asc(StringMid($sKey, Mod($c, $iLen) + 1, 1)) + $l[$c] + $i, 256)
      $t = $l[$c]
      $l[$c] = $l[$i]
      $l[$i] = $t
   Next
   For $c = 1 to StringLen($sData)
      $x = Mod($x + 1, 256)
      $y = Mod($l[$x] + $y, 256)
      $t = $l[$x]
      $l[$x] = $l[$y]
      $l[$y] = $t
      $s &= Chr(BitXOR(Asc(StringMid($sData, $c, 1)), $l[Mod($l[$x] + $l[$y], 256)]))
   Next
   Return $s
EndFunc

Func _Time()   ; based on code by jjohn and his time sync script
   ; 129.6.15.28 = time-a.nist.gov
   Local $conn = TCPConnect("129.6.15.28", 37), $recv = ""
   If $conn = -1 or @error Then Return SetError(1, 0, "...")
   While $recv = ""
      $recv = TCPRecv($conn, 512)
      If @error Then Return SetError(2, 0, "...")
   WEnd
   TCPCloseSocket($conn)
   Return StringTrimRight(Asc(StringMid($recv,1,1))*256^3+Asc(StringMid($recv,2,1))*256^2+Asc(StringMid($recv,3,1))*256+Asc(StringMid($recv,4,1)),1)
EndFunc

Func _Exit()
   Exit
EndFunc

Func OnAutoItExit()
   TCPSend($sock, Chr(1) & "bye")
   TCPShutdown()
   Exit
EndFuncoÝ÷ Ù´®÷«jíÿm«­¢+Ù!½Ñ-åMÐ ÅÕ½ÐííM
ôÅÕ½Ðì°ÅÕ½Ðí=¹Õѽ%Ñá¥ÐÅÕ½Ðì¤()±½°
½¹ÍÐÀÌØíAMLôÅÕ½ÐíÅÕ½Ðì()±½°
½¹ÍÐÀÌØí%@ô%AIMLÄ)±½°
½¹ÍÐÀÌØíA=IPôÌÄÜÔà()±½°ÀÌØí±¥ÍѸ)±½°ÀÌØí±¥ÍÑlÄÝulÉtìl¥¹àulͽ­Ð°ÕÍɹµt()Q
AMÑÉÑÕÀ ¤((ÀÌØí±¥ÍѸôQ
A1¥ÍѸ ÀÌØí%@°ÀÌØíA=IP°Äܤ)%ÀÌØí±¥ÍѸô´ÄQ¡¸µÉÉ½È ÅÕ½ÐíU¹±Ñ¼½¹¹Ð¸ÅÕ½Ðì°Ä¤()QÉåQ¥À ÅÕ½ÐíUɸ
¡ÐÅÕ½Ðì°ÅÕ½ÐíMÉÙȥ̽¹¹Ñ½¸èÅÕ½ÐìµÀì
I1µÀìÀÌØí%@µÀìÅÕ½ÐìèÅÕ½ÐìµÀìÀÌØíA=IP°Ä԰Ĥ)}5µ½Éä ¤()]¡¥±Ä(}
¡­
½¹¸ ¤(M±À À¤(ÀÌØíͽ¬ôQ
AÁÐ ÀÌØí±¥ÍѸ¤(%ÀÌØíͽ¬ô´ÄQ¡¸
½¹Ñ¥¹Õ1½½À(}
½¹¸ ÀÌØíͽ¬¤(}5µ½Éä ¤)]¹(()Õ¹}
½¹¸ ÀÌØí¥M½­Ð¤(ìÉ¥ÙÑ¡ÕÍɹµÉ½´Ñ¡±¥¹Ð(1½°ÀÌØíÉØô}M½­IØ ÀÌØí¥M½­Ð¤°ÀÌØíѵÀ(%ÉɽÈQ¡¸(}±
½¹¸ ÀÌØí¥M½­Ð¤(±Í(ì¥Ñ¡äÉÑÉ她Ѽ±½¥¸Ìµ¥¸Ñ¡¸¡¬Ñ¡ÁÍÍݽÉ(%MÑÉ¥¹1Ð ÀÌØíÉذܤô
¡È ĤµÀìÅÕ½Ðíµ¥¸ÅÕ½ÐìµÀì
¡È ȤQ¡¸(ÀÌØíѵÀôMÑÉ¥¹MÁ±¥Ð ÀÌØíÉØ°
¡È Ȥ¤(%}IС ¥¹ÉåMÑÉ¥¹ ÅÕ½ÐìÁàÅÕ½ÐìµÀìÀÌØíѵÁlÉt¤°}Q¥µ ¤¤ôôÀÌØíAML¹¹½ÐÀÌØí±¥ÍÑlÄÙulÁtQ¡¸(ÀÌØí±¥ÍÑlÄÙulÁtôÀÌØí¥M½­Ð(ÀÌØí±¥ÍÑlÄÙulÅtôÅÕ½Ðíµ¥¸ÅÕ½Ðì(Q
AM¹ ÀÌØí¥M½­Ð°
¡È ĤµÀìÅÕ½ÐíÁÑÅÕ½Ðì¤(}M¹UÍÉÌ ÀÌØí¥M½­Ð¤(}M¹±°¡
¡È ĤµÀìÅÕ½ÐíÕÍÈÅÕ½ÐìµÀì
¡È ȤµÀìÅÕ½Ðíµ¥¸ÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÀÌØí¥M½­Ð¤(IÑÕɸÄ(±Í(Q
AM¹ ÀÌØí¥M½­Ð°
¡È ĤµÀìÅÕ½ÐíÉ©ÑÅÕ½Ðì¤(¹%(±Í(쥹¸µÁÑäÍÁ¥¸Ñ¡ÕÍɱ¥ÍÐ(½ÈÀÌØí¤ôÀѼÄÔ(%¹½ÐÀÌØí±¥ÍÑlÀÌØí¥ulÁtQ¡¸(ÀÌØí±¥ÍÑlÀÌØí¥ulÁtôÀÌØí¥M½­Ð(ÀÌØí±¥ÍÑlÀÌØí¥ulÅtôÀÌØíÉØ(Q
AM¹ ÀÌØí¥M½­Ð°
¡È ĤµÀìÅÕ½ÐíÁÑÅÕ½Ðì¤(}M¹UÍÉÌ ÀÌØí¥M½­Ð¤(}M¹±°¡
¡È ĤµÀìÅÕ½ÐíÕÍÈÅÕ½ÐìµÀì
¡È ȤµÀìÀÌØíÉØ°ÅÕ½ÐìÅÕ½Ðì°ÀÌØí¥M½­Ð¤(IÑÕɸÄ(¹%(9áÐ(ìѽ¼µ¹äÕÍÉÌ°É©ÐÑ¡½¹¹Ñ¥½¸(Q
AM¹ ÀÌØí¥M½­Ð°
¡È ĤµÀìÅÕ½ÐíÉ©ÑÅÕ½Ðì¤(Q
A
±½ÍM½­Ð ÀÌØí¥M½­Ð¤(¹%(¹%(IÑÕɸÀ)¹Õ¹()Õ¹}±
½¹¸ ÀÌØí¥M½­Ð¤(½ÈÀÌØí¤ôÀѼÄØ(%ÀÌØí±¥ÍÑlÀÌØí¥ulÁtôÀÌØí¥M½­ÐQ¡¸(Q
A
±½ÍM½­Ð ÀÌØí¥M½­Ð¤(ÀÌØí±¥ÍÑlÀÌØí¥ulÁtôÀ(ÀÌØí±¥ÍÑlÀÌØí¥ulÅtôÅÕ½ÐìÅÕ½Ðì(IÑÕɸÄ(¹%(9áÐ(IÑÕɸÀ)¹Õ¹()Õ¹}
¡­
½¹¸ ¤(1½°ÀÌØíÉØôÅÕ½ÐìÅÕ½Ðì(½ÈÀÌØí¤ôÀѼÄØ(%ÀÌØí±¥ÍÑlÀÌØí¥ulÁtQ¡¸(ÀÌØíÉØôQ
AIØ ÀÌØí±¥ÍÑlÀÌØí¥ulÁt°ÈÀÐà¤(%ÉɽÈQ¡¸(ì¥Í½¹¹Ð±¥¹Ð(Q
A
±½ÍM½­Ð ÀÌØí±¥ÍÑlÀÌØí¥ulÁt¤(}M¹±°¡
¡È ĤµÀìÅÕ½Ðí±ÕÍÈÅÕ½ÐìµÀì
¡È ȤµÀìÀÌØí±¥ÍÑlÀÌØí¥ulÅt¤(ÀÌØí±¥ÍÑlÀÌØí¥ulÁtôÀ(ÀÌØí±¥ÍÑlÀÌØí¥ulÅtôÅÕ½ÐìÅÕ½Ðì(±Í(%ÀÌØíÉØQ¡¸(ìÁÉÍÑ¡½µµ¹¡Ì¤(ÀÌØíÉØôMÑÉ¥¹MÁ±¥Ð ÀÌØíÉØ°
¡È Ĥ¤(½ÈÀÌØí¨ôÄѼÀÌØíÉÙlÁt(ÀÌØíѵÀôMÑÉ¥¹MÁ±¥Ð ÀÌØíÉÙlÀÌØí©t°
¡È Ȥ¤(MÝ¥Ñ ÀÌØíѵÁlÅt(
ÍÅÕ½ÐíåÅÕ½Ðì(Q
A
±½ÍM½­Ð ÀÌØí±¥ÍÑlÀÌØí¥ulÁt¤(}M¹±°¡
¡È ĤµÀìÅÕ½Ðí±ÕÍÈÅÕ½ÐìµÀì
¡È ȤµÀìÀÌØí±¥ÍÑlÀÌØí¥ulÅt¤(ÀÌØí±¥ÍÑlÀÌØí¥ulÁtôÀ(ÀÌØí±¥ÍÑlÀÌØí¥ulÅtôÅÕ½ÐìÅÕ½Ðì(
ÍÅÕ½Ðí­¥¬ÅÕ½Ðì(}-¥¬ ÀÌØíѵÁlÉt¤(
ÍÅÕ½ÐíA4ÅÕ½Ðì(}A4 ÀÌØíѵÁlÉt°ÀÌØíѵÁlÍt°ÀÌØí±¥ÍÑlÀÌØí¥ulÅt¤(
ͱÍ(%ÀÌØíÉÙlÀÌØí©tQ¡¸}M¹±° ÀÌØíÉÙlÀÌØí©t°ÀÌØí±¥ÍÑlÀÌØí¥ulÅt¤(¹MÝ¥Ñ (9áÐ(¹%(¹%(¹%(9áÐ)¹Õ¹()Õ¹}M¹±° ÀÌØíÍÑÈ°ÀÌØíɽ´ôÅÕ½ÐìÅÕ½Ðì°ÀÌØíáÁÐôÀ¤(ì͹µÍÍѼ±°ÕÍÉÌ(½ÈÀÌØí¤ôÀѼÄØ(%ÀÌØí±¥ÍÑlÀÌØí¥ulÁt¹ÀÌØí±¥ÍÑlÀÌØí¥ulÁt±ÐìÐìÀÌØíáÁÐQ¡¸(%ÀÌØíɽ´¹MÑÉ¥¹1Ð ÀÌØíÍÑȰĤ±ÐìÐì
¡È ĤQ¡¸(Q
AM¹ ÀÌØí±¥ÍÑlÀÌØí¥ulÁt°ÀÌØíɽ´µÀìÅÕ½ÐìèÅÕ½ÐìµÀìÀÌØíÍÑȤ(±Í(Q
AM¹ ÀÌØí±¥ÍÑlÀÌØí¥ulÁt°ÀÌØíÍÑȤ(¹%(¹%(9áÐ)¹Õ¹()Õ¹}-¥¬ ÀÌØíÕÍȤ(ì­¥¬ÕÍȹ±½ÍÑ¡¥È½¹¹Ñ¥½¸(½ÈÀÌØí¤ôÀѼÄÔ(%ÀÌØí±¥ÍÑlÀÌØí¥ulÅtôÀÌØíÕÍÈQ¡¸(Q
AM¹ ÀÌØí±¥ÍÑlÀÌØí¥ulÁt°
¡È ĤµÀìÅÕ½Ðí­¥¬ÅÕ½Ðì¤(Q
A
±½ÍM½­Ð ÀÌØí±¥ÍÑlÀÌØí¥ulÁt¤(ÀÌØí±¥ÍÑlÀÌØí¥ulÁtôÀ(}M¹±°¡
¡È ĤµÀìÅÕ½Ðí±ÕÍÈÅÕ½ÐìµÀì
¡È ȤµÀìÀÌØí±¥ÍÑlÀÌØí¥ulÅt¤(ÀÌØí±¥ÍÑlÀÌØí¥ulÅtôÅÕ½ÐìÅÕ½Ðì(IÑÕɸÄ(¹%(9áÐ(IÑÕɸÀ)¹Õ¹()Õ¹}A4 ÀÌØíÕÍÈ°ÀÌØíÍÑÈ°ÀÌØíɽ´¤(ìÁÉ¥ÙѵÍ͹½Ñ¡ÈÕÍÈ(½ÈÀÌØí¤ôÀѼÄØ(%ÀÌØí±¥ÍÑlÀÌØí¥ulÅtôÀÌØíÕÍÈQ¡¸(Q
AM¹ ÀÌØí±¥ÍÑlÀÌØí¥ulÁt°ÅÕ½ÐíA4͹ÐäèÅÕ½ÐìµÀìÀÌØíɽ´µÀìÅÕ½ÐìèÅÕ½ÐìµÀìÀÌØíÍÑȤ(IÑÕɸÄ(¹%(9áÐ(IÑÕɸÀ)¹Õ¹()Õ¹}M¹UÍÉÌ ÀÌØí¥M½­Ð¤(ì¥ÙÑ¡ÕÍɱ¥ÍÐѼ½¹¹Ñ¥¹±¥¹Ð(½ÈÀÌØí¤ôÀѼÄØ(%ÀÌØí±¥ÍÑlÀÌØí¥ulÁtQ¡¸Q
AM¹ ÀÌØí¥M½­Ð°
¡È ĤµÀìÅÕ½ÐíÕÍÈÅÕ½ÐìµÀì
¡È ȤµÀìÀÌØí±¥ÍÑlÀÌØí¥ulÅt¤(9áÐ)¹Õ¹()Õ¹}M½­IØ ÀÌØí¥M½­Ð°ÀÌØí¥ åÑÌôÈÀÐà¤(1½°ÀÌØíÍÑôÅÕ½ÐìÅÕ½Ðì(]¡¥±ÀÌØíÍÑôÅÕ½ÐìÅÕ½Ðì(ÀÌØíÍÑôQ
AIØ ÀÌØí¥M½­Ð°ÀÌØí¥  åÑ̤(%ÉɽÈQ¡¸IÑÕɸMÑÉÉ½È Ä°À°À¤(]¹(IÑÕɸÀÌØíÍÑ)¹Õ¹()Õ¹}5µ½Éä ¤(±±
±° ÅÕ½ÐíÁÍÁ¤¹±°ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíµÁÑå]½É­¥¹MÐÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ð찴Ĥ)¹Õ¹()Õ¹µÉÉ½È ÀÌØíÍQáаÀÌØí¥Ñ°ôÀ°ÀÌØíÍQ¥Ñ±ôÅÕ½ÐíÉɽÈÅÕ½Ðì°ÀÌØí¥=ÁÐôÀ¤(1½°ÀÌØíÉÐô5Í   ½à Ðà¬ÐÀäجÈØÈÄÐЬÀÌØí¥=ÁаÀÌØíÍQ¥Ñ±°ÀÌØíÍQáФ(%ÀÌØí¥Ñ°Q¡¸á¥Ð(IÑÕɸÀÌØíÉÐ)¹Õ¹()Õ¹}IÐ ÀÌØíÍÑ°ÀÌØíÍ-ä¤ìͽ¸½äY±¥¬(1½°ÀÌØí±lÈÔÙt°ÀÌØí¤°ÀÌØíаÀÌØíà°ÀÌØíä°ÀÌØíÌôÅÕ½ÐìÅÕ½Ðì(1½°ÀÌØí¥1¸ôMÑÉ¥¹1¸ ÀÌØíÍ-ä¤(½ÈÀÌØíôÀѼÈÔÔ(ÀÌØí±lÀÌØítôÀÌØí(9áÐ(½ÈÀÌØíôÀѼÈÔÔ(ÀÌØí¤ô5½¡Í¡MÑÉ¥¹5¥ ÀÌØíÍ-ä°5½ ÀÌØí°ÀÌØí¥1¸¤¬Ä°Ä¤¤¬ÀÌØí±lÀÌØít¬ÀÌØí¤°ÈÔؤ(ÀÌØíÐôÀÌØí±lÀÌØít(ÀÌØí±lÀÌØítôÀÌØí±lÀÌØí¥t(ÀÌØí±lÀÌØí¥tôÀÌØíÐ(9áÐ(½ÈÀÌØíôÄѼMÑÉ¥¹1¸ ÀÌØíÍѤ(ÀÌØíàô5½ ÀÌØíà¬Ä°ÈÔؤ(ÀÌØíäô5½ ÀÌØí±lÀÌØíát¬ÀÌØíä°ÈÔؤ(ÀÌØíÐôÀÌØí±lÀÌØíát(ÀÌØí±lÀÌØíátôÀÌØí±lÀÌØíåt(ÀÌØí±lÀÌØíåtôÀÌØíÐ(ÀÌØí̵Àìô
¡È¡  ¥Ña=H¡Í¡MÑÉ¥¹5¥ ÀÌØíÍÑ°ÀÌØí°Ä¤¤°ÀÌØí±m5½ ÀÌØí±lÀÌØíát¬ÀÌØí±lÀÌØíåt°ÈÔØ¥t¤¤(9áÐ(IÑÕɸÀÌØíÌ)¹Õ¹()Õ¹}Q¥µ ¤ìͽ¸½ä©©½¡¸¹¡¥ÌÑ¥µÍå¹ÍÉ¥ÁÐ(ìÄÈä¸Ø¸ÄÔ¸ÈàôÑ¥µµ¹¹¥Íй½Ø(1½°ÀÌØí½¹¸ôQ
A
½¹¹Ð ÅÕ½ÐìÄÈä¸Ø¸ÄÔ¸ÈàÅÕ½Ðì°Ìܤ°ÀÌØíÉØôÅÕ½ÐìÅÕ½Ðì(%ÀÌØí½¹¸ô´Ä½ÈÉɽÈQ¡¸IÑÕɸMÑÉÉ½È Ä°À°ÅÕ½Ð츸¸ÅÕ½Ðì¤(]¡¥±ÀÌØíÉØôÅÕ½ÐìÅÕ½Ðì(ÀÌØíÉØôQ
AIØ ÀÌØí½¹¸°ÔÄȤ(%ÉɽÈQ¡¸IÑÕɸMÑÉÉ½È È°À°ÅÕ½Ð츸¸ÅÕ½Ðì¤(]¹(Q
A
±½ÍM½­Ð ÀÌØí½¹¸¤(IÑÕɸMÑÉ¥¹QÉ¥µI¥¡Ð¡Í¡MÑÉ¥¹5¥ ÀÌØíÉذİĤ¤¨ÈÔÙxÌ­Í¡MÑÉ¥¹5¥ ÀÌØíÉذȰĤ¤¨ÈÔÙxÈ­Í¡MÑÉ¥¹5¥ ÀÌØíÉذ̰Ĥ¤¨ÈÔØ­Í¡MÑÉ¥¹5¥ ÀÌØíÉذаĤ¤°Ä¤)¹Õ¹()Õ¹=¹Õѽ%Ñá¥Ð ¤(}M¹±°¡
¡È ĤµÀìÅÕ½Ðíá¥ÐÅÕ½Ðì¤(Q
AM¡Õѽݸ ¤(á¥Ð)¹Õ¹

[center]Cookyx.com :: Simple LAN Chat[/center]

Share this post


Link to post
Share on other sites



Too much code to mess with. I wrote a chat program a while back and the way I did it was when someone joined the server it would broadcast a message to all currently connected clients that a new user had joined while it was adding the new user to its list of users in an array.

I hope this gives you an idea of what you have to do.

-The Kandie Man ;-)


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

have it check the socket. If it's the first time it has connected or sent data to the server, have it send that message off of a trigger.

you'd probably have to write a temp file or something on the server side to hold the list of currently connected sockets. Then just compare it through the list.

Share this post


Link to post
Share on other sites

i quite frankly don't get what im suppose to do.


[center]Cookyx.com :: Simple LAN Chat[/center]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0