forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Here is a Client Server chat prgramm i wrote!

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code
View previous topic :: View next topic  
Author Message
DoT_PiTcH
Contributor
Contributor


Joined: 07 Aug 2002
Posts: 85

PostPosted: Thu Jan 30, 2003 2:25 pm    Post subject: Here is a Client Server chat prgramm i wrote! Reply with quote

:SERVER
Code:

EXTERNAL VDSINET.DLL, Public Freeware Key|90257236
Net Socket, Auto
Net Socket, VDSevents
net socket, addr, 127.0.0.1
Net Socket, port, 415
Net Socket, Server
option fieldsep, " "
REM BY DOT PITCH
Title Server
  DIALOG CREATE,Server,-1,0,194,243
  DIALOG ADD,LIST,Users,6,6,180,214
  DIALOG ADD,BUTTON,Closeconnection,222,6,180,16,Close Connection
  DIALOG SHOW
  list add, users, ES_ltd_SVR
 
 
 
 
 
 
 
:Evloop
%e = @event()
if %e
goto %e
else
%%Nete = @Net(Socket,Event)
if %%Nete
goto %%nete
end
goto evloop


:Accept
%%id = @Net(Socket, SENDERID)
Net Socket, Sendid, %%id, Welcome!
goto evloop


:Network
%%id = @Net(Socket, SENDERID)
%%msg = @Net(Socket,Data)
parse "%%cmd;%%Var", %%Msg
if @equal(%%Cmd, /nick)
Net Socket, sendall,%%msg|%%id
goto SetNick
else
if @equal(%%cmd, /leave)
%%id = @Net(Socket, SENDERID)
goto ClientDisconnect
else
Net Socket, Sendall, %%msg
goto evloop


:Error
goto Evloop


:closec
goto ClientDisconnect
:CloseconnectionBUTTON
Net Socket, close
  goto evloop
 
 
:ClientDisconnect
wait .3
%m = @match(users, %%var|%%id)
if %m
list delete, users, %m
Net Socket, Sendall, /left %%var|%%id
else
end
goto evloop


:SetNick
%%id = @Net(Socket, SENDERID)
%m = @match(users, %%var|%%id)
if %m
Net Socket, Sendid, %%id, /NNick
else
list add, users, %%var|%%id
%c = 0
%i = @count(users)
repeat
wait .6
Net Socket, sendid, %%id, %%cmd" "@item(users,%c)
%c = @fadd(%c,1)
until @equal(%c,%i)
end
goto Evloop



:Close
  exit

:CLIENT
Code:

EXTERNAL VDSINET.DLL, Public Freeware Key|90257236
REM BY DOT PITCH
option fieldsep," "
Title E C H O S I D E ltd Chat Client v1.1
  DIALOG CREATE,E C H O S I D E ltd Chat Client 1.1,-1,0,625,320,ontop,nosys
  DIALOG ADD,STYLE,S2,,6,,BLACK,YELLOW
  DIALOG ADD,STYLE,S1,,6,,BLACK,LTGREEN
  DIALOG ADD,MENU,File,&Save,&Connect,-,&Exit
  DIALOG ADD,MENU,Options,Settings,Commands
  DIALOG ADD,MENU,Help,&About
  DIALOG ADD,PROGRESS,CntnPrgrs,308,0,626,12
  DIALOG ADD,EDIT,Typehere,290,0,512,19,,S2
  DIALOG ADD,LIST,MSGBOARD,0,0,512,288,,,S1
  DIALOG ADD,LIST,users,0,512,112,288,,S1,sorted
  DIALOG ADD,BUTTON,Send,290,514,110,19,Send,,default
  DIALOG SHOW
list create, 1
 
 
:Evloop

%%Nete = @Net(Socket,Event)
%e = @event()
if %e
goto %e
else
if %%Nete
goto %%nete
end

goto evloop


:Connect
goto evloop


:Closec
net Socket, SendServer, /leave %%nick
wait 1
exit


:error
goto evloop


:network

%%msg = @Net(Socket,Data)
parse "%%CMD;%%VAR", %%msg
if @equal(%%cmd, /nick)
goto populate
else
if @equal(%%cmd, /left)
goto DePopulate
else
if @equal(%%cmd, /NNick)
goto AIU
else
list add, MSGBOARD, @dlgtext(MSGBOARD)%%msg
list add, 1, @dlgtext(MSGBOARD)%%msg
if @greater(@count(MSGBOARD),20)
repeat
list seek, MSGBOARD, 0
list delete, MSGBOARD
until @equal(@count(MSGBOARD),20)
else
end
goto Evloop


:SaveMENU
%%filename = @input(Save Session As:@tab()"("   Ex. chat1")")
list savefile, MSGBOARD, .\%%filename.txt
  goto evloop
 
 
:ExitMENU
  goto Close
 
 
:SettingsMENU
  goto evloop

 
:CommandsMENU
  goto evloop
 
:ConnectMENU
%%addr = @input(Server's IP Address :)
if @null(%%addr)
warn Nothing Was Entered! @cr()@cr()EX.  198.162.0.1
goto connectmenu
else
%%port = 415
Net Socket, Auto
Net Socket, VDSevents
Net Socket, port, %%port
Net Socket, Addr, %%addr
Net Socket, Client
%%nick = @substr(@input(Enter Desired Nick Name For Session: No Spaces!!!),1,14)
Net Socket, SendServer, /nick %%nick
goto evloop

 
:AboutMENU
  goto evloop
 
 
:SendBUTTON
wait .5
Net Socket, sendserver,%%nick >" "@dlgtext(typehere)
DIALOG CLEAR, typehere

end
goto evloop
 
:AIU
%%nick = @input(Enter Desired Nick Name For Session:)
Net Socket, SendServer, /nick %%nick
goto evloop

:Populate
%m = @match(users,%%var)
if @not(%m)
list add, users, %%var
else
end
goto evloop

:DePopulate
wait .3
%m = @match(users, %%var)
if %m
list delete, users, %%var
else
end
goto evloop

:Close
goto closec





Also note that not all functions on client work so... yeah.

DoT_PiTcH
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group