Hi ZJP,
its done :)
Oh oh hard work, i think in the next time it is better when i don't release anythig if i feel me tired. I hope all bugs are kill'd now ! The Samples run without any error.
@LO-TEKK :) thx
please download the V1.023r !!
Some lines code ....
(change nick with "/nick NICKNAME")
Graphics 500,600,32,2
SetBuffer (BackBuffer())
XNETConfigServerDialog ("www.c64.feuerware.com","xnet/scripts/hostmanager")
Global Session
Global Timer = CreateTimer (30)
Global Name$ ="No Named"+MilliSecs()
Global InputLine$
Global LocalObject
Global rY =0
Global NetSession = False ; TRUE FOR REGISTER HOST OR JOIN AVAIBLE XNET-CHATS
Port=52001
IP$ ="127.0.0.1"
If NETSESSION=True
XNETGetHostList ()
While XNETHostFromList () And Session=0
IP$ =XNETHostIP ()
Port =XNETHostPort ()
Info =XNETHostInfo ()
Wend
EndIf
Session=XNETJoinSession (IP,Port)
AppTitle ("CLIENT")
If Not Session
AppTitle ("HOST")
Session=XNETHostSession (Port)
If NETSESSION=True XNETRegisterHost (Session,"XNET-TEST-CHAT")
EndIf
Const name_slot=1
Const chat_slot=2
If Not Session RuntimeError ("ANYTHING WAS WRONG !!!")
LocalObject = XNETCreateObject (Session)
XNETSetString (LocalObject,name_slot,Name)
;__________________________________________________________________________________
While Not KeyHit (1)
Cls
XNETUpdateSession (Session)
ControlChat()
ControlXNET()
Flip 0
WaitTimer (timer)
Wend
;__________________________________________________________________________________
Function ControlChat ()
Local char=GetKey()
If char
Select char
Case 13
If Not Instr (Mid(Lower(inputline),1,5),"/nick")
If Trim (inputline)>"" addline Name+"> "+inputline
MSG=XNETCreateMessage (LocalObject )
XNETSetString (MSG,chat_slot,inputline )
XNETSendSecureMessage (MSG,0 )
Else
NEWNAME$ =Trim(Mid (inputline,7))
If NEWNAME>""
inputline= "CHANGED NICK TO >"+NEWNAME
ADDLINE NAME+" >"+inputline
Name=NewName
EndIf
MSG=XNETCreateMessage (LocalObject )
XNETSetString (MSG,chat_slot,inputline )
XNETSendSecureMessage (MSG,0 )
XNETSetString (LocalObject,name_slot,name )
EndIf
inputline=""
Case 32
inputline=inputline+" "
Case 8
inputline=Mid(inputline,1,Len(inputline)-1)
Default
inputline=inputline+Trim (Chr(char))
End Select
EndIf
inputline_$=Inputline
If MilliSecs() Mod 500 < 300 inputline_=inputline+"_"
Color 200,200,200
Rect 2,GraphicsHeight ()-22,GraphicsWidth ()-4,1
Color 250,250,250
Text 2,GraphicsHeight ()-20,inputline_
If ry => 600 chat.row = First row : Delete chat.row
ry = 2
For chat.row = Each row
If ry<580 Text 2,ry,chat\txt
ry=ry+20
Next
End Function
Function addLine (txt$)
If Trim (txt) >""
Chat.row=New row
chat\txt=txt
EndIf
End Function
Global Chat.row
Type row
Field txt$
End Type
;__________________________________________________________________________________
Function ControlXnet()
XNETGetObjects (Session)
While XNETCountList ()
OBJ=XNETObjectFromList ()
If XNETObjectRemote (OBJ)
If XNETGetObjectState (Obj) = 1
ADDLINE XNETGetString (obj,name_slot)+" has joined"
EndIf
EndIf
Wend
XNETGetMessages (Session)
While XNETCountList ()
Msg =XNETObjectFromList ( )
Sender =XNETMessageObject (MSG)
MSGString$ =XNETGetString (Sender,name_slot)+">"
MSGString =MsgString+ XNETGetString (MSG,chat_slot )
ADDLINE MSGSTRING
Wend
End Function
Sincere Regards